mirror of
https://github.com/netwide-assembler/nasm.git
synced 2025-10-10 00:25:06 -04:00
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>
This commit is contained in:
@@ -1218,11 +1218,6 @@ static void gencode(int32_t segment, int64_t offset, int bits,
|
||||
insn * ins, const struct itemplate *temp,
|
||||
int64_t insn_end)
|
||||
{
|
||||
static const char condval[] = { /* conditional 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
|
||||
};
|
||||
uint8_t c;
|
||||
uint8_t bytes[4];
|
||||
int64_t size;
|
||||
@@ -1561,7 +1556,7 @@ static void gencode(int32_t segment, int64_t offset, int bits,
|
||||
break;
|
||||
|
||||
case 0330:
|
||||
*bytes = *codes++ ^ condval[ins->condition];
|
||||
*bytes = *codes++ ^ get_cond_opcode(ins->condition);
|
||||
out(offset, segment, bytes, OUT_RAWDATA, 1, NO_SEG, NO_SEG);
|
||||
offset += 1;
|
||||
break;
|
||||
|
||||
11
nasm.h
11
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
|
||||
*/
|
||||
|
||||
Reference in New Issue
Block a user