1 /* RotateDefs.h -- Rotate functions
2 2015-03-25 : Igor Pavlov : Public domain */
3 
4 #ifndef __ROTATE_DEFS_H
5 #define __ROTATE_DEFS_H
6 
7 #ifdef _MSC_VER
8 
9 #include <stdlib.h>
10 
11 /* don't use _rotl with MINGW. It can insert slow call to function. */
12 
13 /* #if (_MSC_VER >= 1200) */
14 #pragma intrinsic(_rotl)
15 #pragma intrinsic(_rotr)
16 /* #endif */
17 
18 #define rotlFixed(x, n) _rotl((x), (n))
19 #define rotrFixed(x, n) _rotr((x), (n))
20 
21 #else
22 
23 /* new compilers can translate these macros to fast commands. */
24 
25 #define rotlFixed(x, n) (((x) << (n)) | ((x) >> (32 - (n))))
26 #define rotrFixed(x, n) (((x) >> (n)) | ((x) << (32 - (n))))
27 
28 #endif
29 
30 #endif
31