forked from SevenChords/CipesAtHome
-
Notifications
You must be signed in to change notification settings - Fork 0
/
rotate.h
376 lines (286 loc) · 17.6 KB
/
rotate.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
/*
* rotate.h
*
* Provides bit rotation operations for integer types.
* Tries hard to get them to optimize to rotation instructions.
* For some reason I don't understand, C still doesn't have a built-in bit rotate operator, so this defines some.
*
* To save you a lot of digging, the functions are
* // Rotate left
* cipes_rotl_u8
* cipes_rotl_u16
* cipes_rotl_u32
* cipes_rotl_u64
* cipes_rotl_u128 // If unsigned __int128 is supported by the compiler
*
* // Rotate right
* cipes_rotr_u8
* cipes_rotr_u16
* cipes_rotr_u32
* cipes_rotr_u64
* cipes_rotr_u128 // If unsigned __int128 is supported by the compiler
*
* Each of these take their respective uintX_t input as their first parameter, and the number of bits to rotate by as the second parameter.
*
* There is also a macro version of all of the above, just use all upper case (e.g. CIPES_ROTR_U32)
*
* Note, there is intentionally no cipes_rotr_uint or similar, as when dealing with bit twiddling,
* you really should be using an exact number of bits you know ahead of time.
*
* In C++ only (because templates are nice), functions
* cipes_rotl
* cipes_rotr
*
* are available, which can take any unsigned integral type.
*
* Created on: Jul 10, 2021
* Author: TechSY730
*/
#ifndef ROTATE_H_
#define ROTATE_H_
#include <stdint.h>
#include "absl/base/attributes.h"
#include "base.h"
// Adapted from https://gcc.godbolt.org/#z:OYLghAFBqd5QCxAYwPYBMCmBRdBLAF1QCcAaPECAKxAEZSBnVAV2OUxAHIBSAJgGY8AO2QAbZlgDU3fgGEGBfEIIA6BDOzcADAEE%2B/LADNhmSQDkAItgBCAVQDi2vQOFiJpmbICGDBpmKq6vyauvqu4lKeongAtoQMahpOTgD0aekZkqgADgSxXqKSBACe2aaGJJLEqAReBJgAtGjMypJexKCpAFSSzMIE/LwA%2BgSSQm3ZZe0MWbn5oiqSkngqmItCfABsMhYxPgDWMtaSaDHZeKKYM0SSAF7%2BqMtCDM9Okj0VxJIxJKbIPlcsoYqjUAO54dAEBAjIoILzjcFQtpCYpZKH%2BIqlcqVISLLopZK6NK9fqbAAsMPG/2YfhmwGQyCKjy8yAIzAKolRmDio3hkh0lieL1IkgARsxRmJ4cBJOhUFchGBOKpUikScpyZTJKCEBdTNUCODIdDRngZoNRScvDTAXgGcj0CdRNKmWMar0/JIAEoAeQAMoSdCken1lAAOLUFUFeYozam05GSTAADwIxC8/MFhmqMUk9OQIuImGA7XQl18QJBhohUNIbx68Md8cBUqEMpuQndNra3v9QvG%2BMDGWHkgACtVRZcYjNEQhZXhDIZ/JhWgajVCRt0nS7G8t7XLFcq8yv/HVTBn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8ajIpZBqYY/oB6LHN3E1ILeapJ7SmkE7YMFQmxe1hi0PwXttAuPCa0EhqL4mYggE2LQFQvA2tkhG41/tWgwxtdiwupd0n12Ae3cpiAe6CsHooFp1bJ6xC0F7WPCdRn/AmbMwup9L6312Yc3gJzf7jFua3cBnCzwwM%2BmTOh1gmHItTpi3OmbXACNEdkFeHbkheCdfkt6VKWTMv4Gy4xmj%2BX6PTUY/wZjsnWPlcwJVnT1Wp09a7WGFQ8k4JCekp1njrWwwiZ%2B%2BWqTjAZNyfbTVrtvB6uNea619r8lOv0CnfwXDcXacM7K1O3g/PfvLrR6V8SP74GPZAGSIAA
// From https://stackoverflow.com/a/776523
typedef int _shift_bits_type;
#ifndef __cplusplus
#define _NEED_EXTERNAL_ROT_DEFS 1
#define _mask_for(int_type) (int_type)((int_type)(CHAR_BIT)*sizeof(int_type)) - (int_type)1
#define _def_rotl_func_manual(unsigned_int_type, function_name, right_function_name) \
inline unsigned_int_type function_name(unsigned_int_type x, _shift_bits_type shift_bit_count) { \
if (shift_bit_count == 0) { \
return x; \
} else if (shift_bit_count < 0) { \
return right_function_name(x, -shift_bit_count); \
} \
const unsigned_int_type mask = _mask_for(unsigned_int_type); \
_assert_for_shifting_function(shift_bit_count <= mask && "'shift_bit_count' must be less then the bit size of the data type"); \
x &= mask; \
return (x << shift_bit_count) | x >> ((-shift_bit_count) & mask); \
}
#define _def_rotr_func_manual(unsigned_int_type, function_name, left_function_name) \
inline unsigned_int_type function_name(unsigned_int_type x, _shift_bits_type shift_bit_count) { \
if (shift_bit_count == 0) { \
return x; \
} else if (shift_bit_count < 0) { \
return left_function_name(x, -shift_bit_count); \
} \
const unsigned_int_type mask = _mask_for(unsigned_int_type); \
_assert_for_shifting_function(shift_bit_count <= mask && "'shift_bit_count' must be less then the bit size of the data type"); \
x &= mask; \
return (x >> shift_bit_count) | x << ((-shift_bit_count) & mask); \
}
#if defined(__has_include)
#if __has_include("x86intrin.h") && _CIPES_IS_X86
#include <x86intrin.h>
#define _intrn_found 1
#elif __has_include("immintrin.h")
#include <immintrin.h>
#define _intrn_found 1
#elif __has_include("intrin.h")
#include <intrin.h>
#define _intrn_found 1
#endif
#endif
#if (defined(_intrn_found) && _intrn_found) || (defined(__clang__) && (defined(__x86_64__) || defined(__i386__)))
#define _cipes_rotate_need_intrinsic_function_param 1
#define _cipes_rotate_need_opposing_function_predef 1
// ***** ROTATE LEFT *****
#define _cipes_rotl(x, shift_bit_count, intrinsic_function_name, unused_rotl_function_name) (intrinsic_function_name((x), (shift_bit_count)))
#define _def_rotl_funct(unsigned_int_type, function_name, intrinsic_function_name, unused_right_function_name) \
ABSL_ATTRIBUTE_ALWAYS_INLINE inline unsigned_int_type function_name(unsigned_int_type x, _shift_bits_type shift_bit_count) { \
return intrinsic_function_name(x, shift_bit_count); \
}
#if _CIPES_SUPPORTS_INT128
// No intrinsics for 128 bit
#define _def_rotl_func_128(unsigned_int_type, function_name, unused_intrinsic_function_name, unused_right_function_name) \
_def_rotl_func_manual(unsigned_int_type, function_name, unused_right_function_name)
#define _cipes_rotl_128(x, shift_bit_count, unused_intrinsic_function_name, rotl_function_name) (rotl_function_name((x), (shift_bit_count)))
#endif
// ***** ROTATE RIGHT *****
#define _cipes_rotr(x, shift_bit_count, intrinsic_function_name, unused_rotr_function_name) (intrinsic_function_name((x), (shift_bit_count)))
#define _def_rotr_funct(unsigned_int_type, function_name, intrinsic_function_name, unused_left_function_name) \
ABSL_ATTRIBUTE_ALWAYS_INLINE inline unsigned_int_type function_name(unsigned_int_type x, _shift_bits_type shift_bit_count) { \
return intrinsic_function_name(x, shift_bit_count); \
}
#if _CIPES_SUPPORTS_INT128
// No intrinsics for 128 bit
#define _def_rotr_func_128(unsigned_int_type, function_name, unused_intrinsic_function_name, unused_right_function_name) \
_def_rotr_func_manual(unsigned_int_type, function_name, unused_right_function_name)
#define _cipes_rotr_128(x, shift_bit_count, unused_intrinsic_function_name, rotr_function_name) (rotr_function_name((x), (shift_bit_count)))
#endif
#else
// No intrinsics found, use a manual implementation
#define _cipes_rotate_need_opposing_function_predef 1
// ***** ROTATE LEFT *****
#define _def_rotl_func(unsigned_int_type, function_name, unused_intrinsic_function_name, right_function_name) \
_def_rotl_func_manual(unsigned_int_type, function_name, right_function_name)
#define _cipes_rotl(x, shift_bit_count, unused_intrinsic_function_name, rotl_function_name) (rotl_function_name((x), (shift_bit_count)))
// ***** ROTATE RIGHT *****
#define _def_rotr_func(unsigned_int_type, function_name, unused_intrinsic_function_name, left_function_name) \
_def_rotl_func_manual(unsigned_int_type, function_name, left_function_name)
#define _cipes_rotr(x, shift_bit_count, unused_intrinsic_function_name, rotr_function_name) (rotr_function_name((x), (shift_bit_count)))
#endif
#else // if defined(__cplusplus)
#if __cplusplus >= 202002L
#include <bit>
// ***** ROTATE LEFT *****
#define _cipes_rotl(x, shift_bit_count, unused_intrinsic_function_name, unused_rotl_function_name) (std::rotl((x), (shift_bit_count)))
#define _def_rotl_funct(unsigned_int_type, function_name, unused_intrinsic_function_name, unused_right_function_name)
ABSL_ATTRIBUTE_ALWAYS_INLINE constexpr inline unsigned_int_type function_name(unsigned_int_type x, _shift_bits_type shift_bit_count { \
return _cipes_rotl(x, shift_bit_count, unused_intrinsic_function_name, function_name); \
}
template <typename UINT_T>
_def_rotl_funct(UINT_T, cipes_rotl, whatever, not_used)
#define _def_rotl_func_128 _def_rotl_funct
// ***** ROTATE RIGHT *****
#define _cipes_rotr(x, shift_bit_count, unused_intrinsic_function_name, unused_rotr_function_name) (std::rotr((x), (shift_bit_count)))
#define _def_rotr_funct(int_type, function_name, unused_intrinsic_function_name, unused_left_function_name)
ABSL_ATTRIBUTE_ALWAYS_INLINE constexpr inline unsigned_int_type function_name(unsigned_int_type x, _shift_bits_type shift_bit_count { \
return _cipes_rotr(x, shift_bit_count, unused_intrinsic_function_name, function_name); \
}
template <typename UINT_T>
_def_rotr_funct(UINT_T, cipes_rotr, whatever, not_used)
#else // if !(__cplusplus >= 202002L)
#include <cassert>
#include <numeric>
#include <limits>
#include <cmath>
#include <type_traits>
namespace internal {
template <typename UINT_T>
ABSL_ATTRIBUTE_UNUSED
constexpr struct _basic_checks {
_CIPES_STATIC_ASSERT(std::is_integral_v<UINT_T>, "Only unsigned integral types are supported (given a non integral type).");
_CIPES_STATIC_ASSERT(std::is_unsigned_v<UINT_T>, "Only unsigned integral types are supported (given a signed type).");
_CIPES_STATIC_ASSERT(std::numeric_limits<UINT_T>::radix == 2, "Non base 2 integer types despite the standard saying they must be?");
};
// ***** ROTATE LEFT *****
template <typename UINT_T, _shift_bits_type shift_bit_count>
ABSL_ATTRIBUTE_UNUSED
constexpr struct _basic_checks_shift_count_static {
private:
ABSL_ATTRIBUTE_UNUSED static _basic_checks<UINT_T> _unused;
_CIPES_STATIC_ASSERT(shift_bit_count != std::numeric_limits<UINT_T>::min, "'shift_bit_count' can't be the minimum value of the shift digit type. " _XSTR(shift_bit_count) " == " _XSTR(std::numeric_limits<UINT_T>::min));
_CIPES_STATIC_ASSERT(std::abs(shift_bit_count) < std::numeric_limits<UINT_T>::digits, "'shift_bit_count' must be less then the bit size of the data type. " _XSTR(shift_bit_count) " >= " _XSTR(std::numeric_limits<UINT_T>::digits));
};
template <typename UINT_T>
constexpr inline UINT_T _rotl_impl(UINT_T x, _shift_bits_type shift_bit_count) {
_basic_checks<UINT_T>();
__assert_for_shifting_function(("'shift_bit_count' can't be the minimum value of the shift digit type.", shift_bit_count != std::numeric_limits<UINT_T>::min));
if (shift_bit_count == 0) {
return x;
} else if (shift_bit_count < 0) {
return _rotr_impl<UINT_T>(x, -shift_bit_count);
}
constexpr int N = std::numeric_limits<UINT_T>::digits;
_assert_for_shifting_function(("'shift_bit_count' must be less then the bit size of the data type", std::abs(shift_bit_count) < N));
return (x << shift_bit_count) | x >> (N - shift_bit_count);
}
template <typename UINT_T, _shift_bits_type shift_bit_count>
constexpr inline UINT_T _rotl_impl(UINT_T x) {
_basic_checks_shift_count_static<UINT_T, shift_bit_count>();
return _rotl_impl(x, shift_bit_count);
}
} // namespace internal
#define _def_rotl_funct(unsigned_int_type, function_name, unused_intrinsic_function_name, unused_left_function_name) \
ABSL_ATTRIBUTE_ALWAYS_INLINE constexpr inline unsigned_int_type function_name(unsigned_int_type x, _shift_bits_type shift_bit_count) { \
return internal::_rotl_impl(x, shift_bit_count); \
}
#define _cipes_rotl(x, shift_bit_count, unused_intrinsic_function_name, rotl_function_name) (rotl_function_name((x), (shift_bit_count)))
template <typename UINT_T>
_def_rotl_funct(UINT_T, cipes_rotl, whatever, not_used)
// ***** ROTATE RIGHT *****
namespace internal {
template <typename UINT_T>
constexpr inline UINT_T _rotr_impl(UINT_T x, _shift_bits_type shift_bit_count) {
_basic_checks<UINT_T>();
_assert_for_shifting_function(("'shift_bit_count' can't be the minimum value of the shift digit type.", shift_bit_count != std::numeric_limits<UINT_T>::min));
if (shift_bit_count == 0) {
return x;
} else if (shift_bit_count < 0) {
return _rotl_impl<UINT_T>(x, -shift_bit_count);
}
constexpr int N = std::numeric_limits<UINT_T>::digits;
_assert_for_shifting_function(("'shift_bit_count' must be less then the bit size of the data type", std::abs(shift_bit_count) < N));
return (x >> shift_bit_count) | x << (N - shift_bit_count);
}
template <typename UINT_T, _shift_bits_type shift_bit_count>
constexpr inline UINT_T _rotr_impl(UINT_T x) {
_basic_checks_shift_count_static<UINT_T, shift_bit_count>();
return _rotr_impl(x, shift_bit_count);
}
} // namespace internal
#define _def_rotr_funct(unsigned_int_type, function_name, unused_intrinsic_function_name, unused_left_function_name) \
ABSL_ATTRIBUTE_ALWAYS_INLINE constexpr inline unsigned_int_type function_name(unsigned_int_type x, _shift_bits_type shift_bit_count) { \
return internal::_rotr_impl(x, shift_bit_count); \
}
#define _cipes_rotr(x, shift_bit_count, unused_intrinsic_function_name, rotr_function_name) (rotr_function_name((x), (shift_bit_count)))
template <typename UINT_T>
_def_rotr_funct(UINT_T, cipes_rotr, whatever, not_used)
#endif // __cplusplus >= 202002L
#endif // !defined(__cplusplus)
#ifdef __cplusplus
extern "C" {
#endif
#define _declare_rot_func(unsigned_int_type, function_name) ABSL_ATTRIBUTE_UNUSED unsigned_int_type function_name(unsigned_int_type x, _shift_bits_type shift_bit_count); _REQUIRE_SEMICOLON_TOP_LEVEL_OK
// If one of the branches didn't choose otherwise, assume we can use the normal path for 128-bit integers
#if _CIPES_SUPPORTS_INT128
#ifndef _def_rotl_func_128
#define _def_rotl_func_128 _def_rotl_funct
#endif
#ifndef _def_rotr_func_128
#define _def_rotr_func_128 _def_rotr_funct
#endif
#ifndef _cipes_rotl_128
#define _cipes_rotl_128 _cipes_rotl
#endif
#ifndef _cipes_rotr_128
#define _cipes_rotr_128 _cipes_rotr
#endif
#endif
#if _cipes_rotate_need_opposing_function_predef
inline _declare_rot_func(uint8_t, cipes_rotl_u8);
inline _declare_rot_func(uint16_t, cipes_rotl_u16);
inline _declare_rot_func(uint32_t, cipes_rotl_u32);
inline _declare_rot_func(uint64_t, cipes_rotl_u64);
#if _CIPES_SUPPORTS_INT128
inline _declare_rot_func(__uint128, cipes_rotl_u128);
#endif
inline _declare_rot_func(uint8_t, cipes_rotr_u8);
inline _declare_rot_func(uint16_t, cipes_rotr_u16);
inline _declare_rot_func(uint32_t, cipes_rotr_u32);
inline _declare_rot_func(uint64_t, cipes_rotr_u64);
#if _CIPES_SUPPORTS_INT128
inline _declare_rot_func(__uint128, cipes_rotr_u128);
#endif
#endif
_def_rotl_funct(uint8_t, cipes_rotl_u8, __rolb, cipes_rotr_u8)
#define CIPES_ROTL_U8(x, shift_bit_count) (_cipes_rotl(x, shift_bit_count, __rolb, cipes_rotl_u8))
_def_rotl_funct(uint16_t, cipes_rotl_u16, _rotwl, cipes_rotr_u16)
#define CIPES_ROTL_U16(x, shift_bit_count) (_cipes_rotl(x, shift_bit_count, _rotwl, cipes_rotl_u16))
_def_rotl_funct(uint32_t, cipes_rotl_u32, _rotl, cipes_rotr_u32)
#define CIPES_ROTL_U32(x, shift_bit_count) (_cipes_rotl(x, shift_bit_count, _rotl, cipes_rotl_u32))
_def_rotl_funct(uint64_t, cipes_rotl_u64, _lrotl, cipes_rotr_u64)
#define CIPES_ROTL_U64(x, shift_bit_count) (_cipes_rotl(x, shift_bit_count, _lrotl, cipes_rotl_u64))
#if _CIPES_SUPPORTS_INT128
_def_rotl_func_128(__uint128, cipes_rotl_u128, _no_instrsc, cipes_rotr_u128);
#define CIPES_ROTL_128(x, shift_bit_count) (_cipes_rotl_128(x, shift_bit_count, _no_instrsc, cipes_rotl_u128))
#endif
_def_rotl_funct(uint8_t, cipes_rotr_u8, __rorb, cipes_rotl_u8)
#define CIPES_ROTR_U8(x, shift_bit_count) (_cipes_rotr(x, shift_bit_count, __rorb, cipes_rotr_u8))
_def_rotl_funct(uint16_t, cipes_rotr_u16, _rotwr, cipes_rotl_u16)
#define CIPES_ROTR_U16(x, shift_bit_count) (_cipes_rotr(x, shift_bit_count, _rotwr, cipes_rotr_u16))
_def_rotl_funct(uint32_t, cipes_rotr_u32, _rotl, cipes_rotl_u32)
#define CIPES_ROTR_U32(x, shift_bit_count) (_cipes_rotr(x, shift_bit_count, _rotr, cipes_rotr_u32))
_def_rotl_funct(uint64_t, cipes_rotr_u64, _lrotl, cipes_rotl_u64)
#define CIPES_ROTR_U64(x, shift_bit_count) (_cipes_rotr(x, shift_bit_count, _lrotr, cipes_rotr_u64))
#if _CIPES_SUPPORTS_INT128
_def_rotr_func_128(__uint128, cipes_rotr_u128, _no_instrsc, cipes_rotl_u128);
#define CIPES_ROTR_128(x, shift_bit_count) (_cipes_rotr_128(x, shift_bit_count, _no_instrsc, cipes_rotr_u128))
#endif
#ifdef __cplusplus
} // extern "C"
#endif
#endif /* ROTATE_H_ */