diff options
author | Kyle Gunger <kgunger12@gmail.com> | 2024-01-28 00:16:11 -0500 |
---|---|---|
committer | Kyle Gunger <kgunger12@gmail.com> | 2024-01-28 00:16:11 -0500 |
commit | 14b11511d804e149c02e8163b45e9f4aac81b4de (patch) | |
tree | f6cb8c10a6864abb3b582568b323821ea8d5d672 /compiler.c | |
parent | dc153016a42091d1f4edfa2c2cbe8656eadc8596 (diff) |
negative offset _gen_address
Diffstat (limited to 'compiler.c')
-rw-r--r-- | compiler.c | 10 |
1 files changed, 8 insertions, 2 deletions
@@ -619,12 +619,18 @@ char *_gen_address(char *prefix, char *base, char *offset, int mult, int add) { } } - if(add > 0) { - vect_push_string(&out, " + "); + if(add != 0) { + if (add > 0) { + vect_push_string(&out, " + "); + } else { + vect_push_string(&out, " - "); + add = -add; + } char *astr = int_to_str(add); vect_push_string(&out, astr); free(astr); } + vect_push_string(&out, "]"); |