diff options
Diffstat (limited to 'asm/intel64/codes.cpp')
-rw-r--r-- | asm/intel64/codes.cpp | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/asm/intel64/codes.cpp b/asm/intel64/codes.cpp new file mode 100644 index 0000000..a1d9e87 --- /dev/null +++ b/asm/intel64/codes.cpp @@ -0,0 +1,17 @@ +#include "codes.h" + +// REX prefix: 0b0100WRXB +std::vector<uint8_t> REX(std::string s) { + uint8_t result{0b01000000}; + if (s == "W") + result |= 0b00001000; + if (s == "R") + result |= 0b00000100; + if (s == "X") + result |= 0b00000010; + if (s == "B") + result |= 0b00000001; + + return { result }; +} + |