nooc

nooc programming language compiler
git clone git://git.nihaljere.xyz/nooc
Log | Files | Refs | LICENSE

commit cc111475bc33d54e10d5571909e2641cff65a92e
parent d1a368bb9727d8e9c49a480bb56f0b06c1b29294
Author: Nihal Jere <nihal@nihaljere.xyz>
Date:   Thu, 27 Jan 2022 16:34:07 -0600

x64: handle je with 32-bit offset

Diffstat:
Mx64.c | 15+++++++++++++--
1 file changed, 13 insertions(+), 2 deletions(-)

diff --git a/x64.c b/x64.c @@ -652,13 +652,24 @@ static size_t je(struct data *text, int64_t offset) { uint8_t temp; - if (-256 <= offset && offset <= 255) { + if (-128 <= offset && offset <= 127) { int8_t i = offset; if (text) { array_addlit(text, 0x74); - array_addlit(text, i); + array_add(text, i); } return 2; + } else if (-2147483648 <= offset && offset <= 2147483647) { + int32_t i = offset; + if (text) { + array_addlit(text, 0x0F); + array_addlit(text, 0x84); + array_addlit(text, ((uint32_t) i) & 0xFF); + array_addlit(text, (((uint32_t) i) >> 8) & 0xFF); + array_addlit(text, (((uint32_t) i) >> 16) & 0xFF); + array_addlit(text, (((uint32_t) i) >> 24) & 0xFF); + } + return 6; } else { die("unimplemented je offet!"); }