diff options
| author | Michael Forney <[email protected]> | 2021-10-19 13:41:29 -0700 |
|---|---|---|
| committer | Michael Forney <[email protected]> | 2021-10-19 13:43:22 -0700 |
| commit | 1ac09dc704d199bb680b9b5939907ec828b5a61e (patch) | |
| tree | b6b312474ed78e1257a3651f7dd90a5ec1a0c594 /main.c | |
| parent | af5b8e24c7c5a3db4ba4a9718375b95db57a1a25 (diff) | |
Use disp8 when possible for memarg.
Diffstat (limited to 'main.c')
| -rw-r--r-- | main.c | 12 |
1 files changed, 5 insertions, 7 deletions
@@ -395,14 +395,12 @@ assemblemem(const Memarg* memarg, Rex rex, VarBytes prefix, VarBytes opcode, /* Case when we don't need sib */ if (memarg->index == ASM_NO_REG && memarg->scale == 0 && ((rm & 7) != 4)) { - if (memarg->disp.l == 0 && memarg->disp.c == 0) { - if ((rm & 7) == 5) { - mod = 1; - } else { - mod = 0; - } - } else { + if (memarg->disp.l != NULL || memarg->disp.c > INT8_MAX || memarg->disp.c < INT8_MIN) { mod = 2; + } else if (memarg->disp.c != 0 || (rm & 7) == 5) { + mod = 1; + } else { + mod = 0; } assemblevbytes(prefix); |
