diff options
author | Mike Pall <mike> | 2020-06-23 03:14:35 +0200 |
---|---|---|
committer | Mike Pall <mike> | 2020-06-23 03:14:35 +0200 |
commit | 471f8936cbd6aa80a937e375fe53ecadab93696a (patch) | |
tree | d0dfe4bb3b90c36b2861050580b902c12651f865 /src/lj_def.h | |
parent | 17fb96d904d49126bebce78fd0dd14019668998a (diff) | |
download | luajit-471f8936cbd6aa80a937e375fe53ecadab93696a.tar.gz luajit-471f8936cbd6aa80a937e375fe53ecadab93696a.tar.bz2 luajit-471f8936cbd6aa80a937e375fe53ecadab93696a.zip |
Fix pointer check for non-GC64 mode.
Thanks to Stefan Hett.
Diffstat (limited to '')
-rw-r--r-- | src/lj_def.h | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/src/lj_def.h b/src/lj_def.h index e458c89f..5e63da3e 100644 --- a/src/lj_def.h +++ b/src/lj_def.h | |||
@@ -104,9 +104,10 @@ typedef unsigned int uintptr_t; | |||
104 | #define checku16(x) ((x) == (int32_t)(uint16_t)(x)) | 104 | #define checku16(x) ((x) == (int32_t)(uint16_t)(x)) |
105 | #define checki32(x) ((x) == (int32_t)(x)) | 105 | #define checki32(x) ((x) == (int32_t)(x)) |
106 | #define checku32(x) ((x) == (uint32_t)(x)) | 106 | #define checku32(x) ((x) == (uint32_t)(x)) |
107 | #define checkptr31(x) (((uint64_t)(uintptr_t)(x) >> 31) == 0) | ||
107 | #define checkptr32(x) ((uintptr_t)(x) == (uint32_t)(uintptr_t)(x)) | 108 | #define checkptr32(x) ((uintptr_t)(x) == (uint32_t)(uintptr_t)(x)) |
108 | #define checkptr47(x) (((uint64_t)(uintptr_t)(x) >> 47) == 0) | 109 | #define checkptr47(x) (((uint64_t)(uintptr_t)(x) >> 47) == 0) |
109 | #define checkptrGC(x) (LJ_GC64 ? checkptr47((x)) : LJ_64 ? checkptr32((x)) :1) | 110 | #define checkptrGC(x) (LJ_GC64 ? checkptr47((x)) : LJ_64 ? checkptr31((x)) :1) |
110 | 111 | ||
111 | /* Every half-decent C compiler transforms this into a rotate instruction. */ | 112 | /* Every half-decent C compiler transforms this into a rotate instruction. */ |
112 | #define lj_rol(x, n) (((x)<<(n)) | ((x)>>(-(int)(n)&(8*sizeof(x)-1)))) | 113 | #define lj_rol(x, n) (((x)<<(n)) | ((x)>>(-(int)(n)&(8*sizeof(x)-1)))) |