summaryrefslogtreecommitdiff
path: root/src/common/common_funcs.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/common/common_funcs.h')
-rw-r--r--src/common/common_funcs.h12
1 files changed, 9 insertions, 3 deletions
diff --git a/src/common/common_funcs.h b/src/common/common_funcs.h
index 88e452a16..ed20c3629 100644
--- a/src/common/common_funcs.h
+++ b/src/common/common_funcs.h
@@ -45,14 +45,20 @@
45 45
46// GCC 4.8 defines all the rotate functions now 46// GCC 4.8 defines all the rotate functions now
47// Small issue with GCC's lrotl/lrotr intrinsics is they are still 32bit while we require 64bit 47// Small issue with GCC's lrotl/lrotr intrinsics is they are still 32bit while we require 64bit
48#ifndef _rotl 48#ifdef _rotl
49inline u32 _rotl(u32 x, int shift) { 49#define rotl _rotl
50#else
51inline u32 rotl(u32 x, int shift) {
50 shift &= 31; 52 shift &= 31;
51 if (!shift) return x; 53 if (!shift) return x;
52 return (x << shift) | (x >> (32 - shift)); 54 return (x << shift) | (x >> (32 - shift));
53} 55}
56#endif
54 57
55inline u32 _rotr(u32 x, int shift) { 58#ifdef _rotr
59#define rotr _rotr
60#else
61inline u32 rotr(u32 x, int shift) {
56 shift &= 31; 62 shift &= 31;
57 if (!shift) return x; 63 if (!shift) return x;
58 return (x >> shift) | (x << (32 - shift)); 64 return (x >> shift) | (x << (32 - shift));