diff options
| author | Andrew Chambers <[email protected]> | 2021-10-09 00:33:47 +1300 |
|---|---|---|
| committer | Andrew Chambers <[email protected]> | 2021-10-09 00:33:47 +1300 |
| commit | ee80372abea5d9a2ff100f1ddb8be08470cc272d (patch) | |
| tree | 4904b7d3deb3ae5289acaa4c4461a78d45caabf6 /main.c | |
| parent | a8cc59047d02d5c5b352b10a630f73249dc24a5d (diff) | |
Refactor.
Diffstat (limited to 'main.c')
| -rw-r--r-- | main.c | 9 |
1 files changed, 5 insertions, 4 deletions
@@ -439,15 +439,16 @@ static void assemblebasicop(Instr *instr, uint8_t opcode, uint8_t immreg) { } static void assemblexchg(Instr *xchg) { - static uint8_t variant2op[14] = {0x90, 0x90, 0x90, 0x90, 0x90, 0x90, 0x86, - 0x86, 0x87, 0x87, 0x87, 0x87, 0x87, 0x87}; + static uint8_t variant2op[18] = {0x90, 0x90, 0x90, 0x90, 0x90, 0x90, + 0x86, 0x87, 0x87, 0x87, 0x86, 0x87, + 0x87, 0x87, 0x86, 0x87, 0x87, 0x87}; uint8_t opcode = variant2op[xchg->variant]; - if (xchg->variant <= 5) { + if (xchg->variant < 6) { assembleplusr(opcode, (xchg->variant % 2) ? xchg->src->kind : xchg->dst->kind); } else { /* Uses a pattern in the variant table. */ - uint8_t opsz = 1 << (((xchg->variant - 6) / 2) % 4); + uint8_t opsz = 1 << ((xchg->variant - 6) % 4); assemblerrm(xchg, opcode, opsz); } } |
