diff options
author | Igor Pavlov <87184205+ip7z@users.noreply.github.com> | 2021-12-27 00:00:00 +0000 |
---|---|---|
committer | Igor Pavlov <87184205+ip7z@users.noreply.github.com> | 2022-03-18 15:35:13 +0500 |
commit | f19f813537c7aea1c20749c914e756b54a9c3cf5 (patch) | |
tree | 816ba62ca7c0fa19f2eb46d9e9d6f7dd7c3a744d /C/RotateDefs.h | |
parent | 98e06a519b63b81986abe76d28887f6984a7732b (diff) | |
download | 7zip-21.07.tar.gz 7zip-21.07.tar.bz2 7zip-21.07.zip |
'21.07'21.07
Diffstat (limited to '')
-rw-r--r-- | C/RotateDefs.h | 30 |
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 | ||
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 | ||