summaryrefslogtreecommitdiff
path: root/nasm.h
diff options
context:
space:
mode:
authorCyrill Gorcunov <gorcunov@gmail.com>2013-03-03 14:34:31 +0400
committerCyrill Gorcunov <gorcunov@gmail.com>2013-03-03 14:34:31 +0400
commit83e6924e1a583d432e9a54c68a59779da5d8ce3d (patch)
tree7b9747b563cce77bb2f20b524b529565d39617d6 /nasm.h
parentbfb581c8e00f3b159cbb67c2235bce15c5b1713a (diff)
downloadnasm-83e6924e1a583d432e9a54c68a59779da5d8ce3d.tar.gz
nasm-83e6924e1a583d432e9a54c68a59779da5d8ce3d.tar.bz2
nasm-83e6924e1a583d432e9a54c68a59779da5d8ce3d.zip
Move conditional opcodes close to enum ccode definition
Thus if someone need to rework this code he won't need to jump between files trying to figure out where enum and opcodes lay. Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
Diffstat (limited to 'nasm.h')
-rw-r--r--nasm.h11
1 files changed, 11 insertions, 0 deletions
diff --git a/nasm.h b/nasm.h
index a9bff49..97cef3c 100644
--- a/nasm.h
+++ b/nasm.h
@@ -466,6 +466,17 @@ enum ccode { /* condition code names */
C_none = -1
};
+static inline uint8_t get_cond_opcode(enum ccode c)
+{
+ static const uint8_t ccode_opcodes[] = {
+ 0x7, 0x3, 0x2, 0x6, 0x2, 0x4, 0xf, 0xd, 0xc, 0xe, 0x6, 0x2,
+ 0x3, 0x7, 0x3, 0x5, 0xe, 0xc, 0xd, 0xf, 0x1, 0xb, 0x9, 0x5,
+ 0x0, 0xa, 0xa, 0xb, 0x8, 0x4
+ };
+
+ return ccode_opcodes[(int)c];
+}
+
/*
* REX flags
*/