summaryrefslogtreecommitdiff
path: root/gen_x86.c
diff options
context:
space:
mode:
authorMichael Pavone <pavone@retrodev.com>2020-04-30 23:33:55 -0700
committerMichael Pavone <pavone@retrodev.com>2020-04-30 23:33:55 -0700
commitc8bd09a608de47953ccb47ec553924a4a4b4203f (patch)
tree0dfda41f89c6a65d9e75e0aeed2abfa9b05b7bb9 /gen_x86.c
parente872964e6a147ef0e1f5a14913127660b6627a5e (diff)
Fix some questionable comparisons between 64-bit values and literals that fit in 32-bit integers
Diffstat (limited to 'gen_x86.c')
-rw-r--r--gen_x86.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/gen_x86.c b/gen_x86.c
index 18f1d24..3737461 100644
--- a/gen_x86.c
+++ b/gen_x86.c
@@ -171,7 +171,7 @@ char * x86_sizes[] = {
};
#ifdef X86_64
-#define CHECK_DISP(disp) (disp <= 0x7FFFFFFF && disp >= -2147483648)
+#define CHECK_DISP(disp) (disp <= ((ptrdiff_t)INT32_MAX) && disp >= ((ptrdiff_t)INT32_MIN))
#else
#define CHECK_DISP(disp) 1
#endif
@@ -1261,7 +1261,7 @@ void mov_ir(code_info *code, int64_t val, uint8_t dst, uint8_t size)
check_alloc_code(code, 14);
code_ptr out = code->cur;
uint8_t sign_extend = 0;
- if (size == SZ_Q && val <= 0x7FFFFFFF && val >= -2147483648) {
+ if (size == SZ_Q && val <= ((int64_t)INT32_MAX) && val >= ((int64_t)INT32_MIN)) {
sign_extend = 1;
}
if (size == SZ_W) {