diff options
Diffstat (limited to 'src/lj_def.h')
-rw-r--r-- | src/lj_def.h | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/src/lj_def.h b/src/lj_def.h index 876ce95f..27b6d6b7 100644 --- a/src/lj_def.h +++ b/src/lj_def.h | |||
@@ -197,7 +197,16 @@ static LJ_AINLINE uint64_t lj_bswap64(uint64_t x) | |||
197 | } | 197 | } |
198 | #endif | 198 | #endif |
199 | #else | 199 | #else |
200 | #error "missing define for lj_bswap()" | 200 | static LJ_AINLINE uint32_t lj_bswap(uint32_t x) |
201 | { | ||
202 | return (x << 24) | ((x & 0xff00) << 8) | ((x >> 8) & 0xff00) | (x >> 24); | ||
203 | } | ||
204 | |||
205 | static LJ_AINLINE uint64_t lj_bswap64(uint64_t x) | ||
206 | { | ||
207 | return (uint64_t)lj_bswap((uint32_t)(x >> 32)) | | ||
208 | ((uint64_t)lj_bswap((uint32_t)x) << 32); | ||
209 | } | ||
201 | #endif | 210 | #endif |
202 | 211 | ||
203 | typedef union __attribute__((packed)) Unaligned16 { | 212 | typedef union __attribute__((packed)) Unaligned16 { |