diff options
| author | Andrew Chambers <[email protected]> | 2021-10-14 22:39:39 +1300 |
|---|---|---|
| committer | Andrew Chambers <[email protected]> | 2021-10-14 22:39:39 +1300 |
| commit | a66c85675226c82d1ec0e9cf22fdcff552e406d7 (patch) | |
| tree | 72092f6527eb78fbeae3723537d28765c4f998e7 /main.c | |
| parent | ec403dd16c5b417086e63faee5912b78a1ffeb59 (diff) | |
Use short address displacement when possible.
Diffstat (limited to 'main.c')
| -rw-r--r-- | main.c | 4 |
1 files changed, 2 insertions, 2 deletions
@@ -372,11 +372,11 @@ static void assemblemem(const Memarg *memarg, uint8_t rexw, VarBytes prefix, base = rm; rm = 4; - // TODO: if our disp fits in a +disp8, use that instead. if (memarg->disp.c == 0 && memarg->disp.l == 0 && ((base & 7) != 5)) { mod = 0; /* +0 */ } else { - if (memarg->disp.c == 0 && memarg->disp.l == 0) { + if (memarg->disp.l == NULL && memarg->disp.c >= -128 && + memarg->disp.c <= 127) { mod = 1; /* +disp8 */ } else { mod = 2; /* +disp32 */ |
