diff options
Diffstat (limited to 'src/lj_def.h')
-rw-r--r-- | src/lj_def.h | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/src/lj_def.h b/src/lj_def.h index de4ad1be..f6b5432d 100644 --- a/src/lj_def.h +++ b/src/lj_def.h | |||
@@ -140,7 +140,12 @@ static LJ_AINLINE uint32_t lj_fls(uint32_t x) | |||
140 | #define lj_fls(x) ((uint32_t)(__builtin_clz(x)^31)) | 140 | #define lj_fls(x) ((uint32_t)(__builtin_clz(x)^31)) |
141 | #endif | 141 | #endif |
142 | 142 | ||
143 | #if defined(__i386__) || defined(__x86_64__) | 143 | #if __GNUC__ >= 4 && __GNUC_MINOR__ >= 3 |
144 | static LJ_AINLINE uint32_t lj_bswap(uint32_t x) | ||
145 | { | ||
146 | return (uint32_t)__builtin_bswap32((int32_t)x); | ||
147 | } | ||
148 | #elif defined(__i386__) || defined(__x86_64__) | ||
144 | static LJ_AINLINE uint32_t lj_bswap(uint32_t x) | 149 | static LJ_AINLINE uint32_t lj_bswap(uint32_t x) |
145 | { | 150 | { |
146 | uint32_t r; __asm__("bswap %0" : "=r" (r) : "0" (x)); return r; | 151 | uint32_t r; __asm__("bswap %0" : "=r" (r) : "0" (x)); return r; |