aboutsummaryrefslogtreecommitdiff
path: root/C/RotateDefs.h
diff options
context:
space:
mode:
Diffstat (limited to 'C/RotateDefs.h')
-rw-r--r--C/RotateDefs.h30
1 files changed, 30 insertions, 0 deletions
diff --git a/C/RotateDefs.h b/C/RotateDefs.h
new file mode 100644
index 0000000..8f01d1a
--- /dev/null
+++ b/C/RotateDefs.h
@@ -0,0 +1,30 @@
1/* RotateDefs.h -- Rotate functions
22015-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