summaryrefslogtreecommitdiffhomepage
path: root/asm/intel64/codes.cpp
diff options
context:
space:
mode:
authorRoland Reichwein <mail@reichwein.it>2020-10-17 21:45:37 +0200
committerRoland Reichwein <mail@reichwein.it>2020-10-17 21:45:37 +0200
commit8f28495ab9a8ebf53868405541e907394895e51f (patch)
tree51b27870ed64522e1d54e4f031276e18fe181ee8 /asm/intel64/codes.cpp
parent72ff79d76c7ec16ea1b95c72af0838f0e1150735 (diff)
Add add
Diffstat (limited to 'asm/intel64/codes.cpp')
-rw-r--r--asm/intel64/codes.cpp17
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 };
+}
+