diff options
| author | Ryan Houdek <Sonicadvance1@gmail.com> | 2013-04-03 12:42:58 -0500 |
|---|---|---|
| committer | Ryan Houdek <Sonicadvance1@gmail.com> | 2013-04-03 12:43:17 -0500 |
| commit | d06379fc594e95faba1bc5cc0f8c56b1bc818d60 (patch) | |
| tree | 46b7897f4b6a93ca3e91ab29a3e4f979b0300f8f /Source/Core/Common | |
| parent | 61c327ba8b2e09e67acbcd7d1c807910fc0c1a68 (diff) | |
Fix 32bit Linux. GCC's lrotl/lrotr instrinsic functions are 32bit when building for 32bit, we require 64bit at all times, so keep using our own instead.
Diffstat (limited to 'Source/Core/Common')
| -rw-r--r-- | Source/Core/Common/Src/CommonFuncs.h | 18 |
1 files changed, 8 insertions, 10 deletions
diff --git a/Source/Core/Common/Src/CommonFuncs.h b/Source/Core/Common/Src/CommonFuncs.h index 56ada6ba4e..e5a52a28a6 100644 --- a/Source/Core/Common/Src/CommonFuncs.h +++ b/Source/Core/Common/Src/CommonFuncs.h @@ -67,32 +67,30 @@ _mm_shuffle_epi8(__m128i a, __m128i mask) #endif #define ARRAYSIZE(A) (sizeof(A)/sizeof((A)[0])) // GCC 4.8 defines all the rotate functions now -#ifdef _rotl -#define _rotl64 _lrotl -#define _rotr64 _lrotr -#else +// Small issue with GCC's lrotl/lrotr intrinsics is they are still 32bit while we require 64bit +#ifndef _rotl inline u32 _rotl(u32 x, int shift) { shift &= 31; if (!shift) return x; return (x << shift) | (x >> (32 - shift)); } -inline u64 _rotl64(u64 x, unsigned int shift){ - unsigned int n = shift % 64; - return (x << n) | (x >> (64 - n)); -} - inline u32 _rotr(u32 x, int shift) { shift &= 31; if (!shift) return x; return (x >> shift) | (x << (32 - shift)); } +#endif + +inline u64 _rotl64(u64 x, unsigned int shift){ + unsigned int n = shift % 64; + return (x << n) | (x >> (64 - n)); +} inline u64 _rotr64(u64 x, unsigned int shift){ unsigned int n = shift % 64; return (x >> n) | (x << (64 - n)); } -#endif #else // WIN32 // Function Cross-Compatibility |
