aboutsummaryrefslogtreecommitdiff
path: root/main.c
diff options
context:
space:
mode:
authorMichael Forney <[email protected]>2021-10-19 13:47:31 -0700
committerMichael Forney <[email protected]>2021-10-19 13:47:31 -0700
commit936dd9a97e454747f8783fda8f1ee0c13d3f991d (patch)
tree9f1ee66b217ba71e04d5ee4c4800e13addfbe629 /main.c
parentaa8a1c835b392023d2551257ee02951e43ee27db (diff)
Consider change in instruction size when calculating jump distance.
If we previously used a 4-byte offset, the instruction is 4 bytes larger than if we were to use a 1 byte offset. Therefore, an instruction whose previous offset was 0x83 should still be eligible for 1 byte encoding.
Diffstat (limited to 'main.c')
-rw-r--r--main.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/main.c b/main.c
index 8f17d17..978669c 100644
--- a/main.c
+++ b/main.c
@@ -503,7 +503,7 @@ assemblejmp(const Jmp* j)
} else {
distance = target->wco - cursection->hdr.sh_size;
}
- if ((distance - 1) >= -128 && (distance - 1) <= 127) {
+ if ((distance - 1) >= -128 && (distance - 5) <= 127) {
jmpsize = 1;
} else {
jmpsize = 4;