Go to the documentation of this file.
30 #if defined(__STDC__) && __STDC_VERSION__ >= 199901L
31 #define STATIC_INLINE static inline
32 #elif defined(__GNUC__) || defined(__clang__)
33 #define STATIC_INLINE static __inline__
35 #define STATIC_INLINE static
42 #if defined(__x86_64) || defined(__x86_64__) || \
43 defined(__i386) || defined(__i386__) || \
44 defined(__AVR__) || defined(__arm) || defined(__arm__) || \
45 defined(_M_AMD64) || defined(_M_X64) || defined(_M_IX86) || \
46 defined(_M_IA64) || defined(_M_ARM) || defined(_M_ARM_FP) || \
47 (defined(__BYTE_ORDER__) && __BYTE_ORDER__ == 1234) || \
48 defined(__LITTLE_ENDIAN__)
49 #define LW_UTIL_LITTLE_ENDIAN 1
50 #elif (defined(__BYTE_ORDER__) && __BYTE_ORDER__ == 4321) || \
51 defined(__BIG_ENDIAN__) || defined(__m68k__)
54 #error "Cannot determine the endianess of this platform"
58 #if defined(__x86_64) || defined(__x86_64__) || \
59 defined(__aarch64__) || defined(__ARM_ARCH_ISA_A64) || \
60 defined(_M_AMD64) || defined(_M_X64) || defined(_M_IA64) || \
61 (defined(__riscv) && __riscv_xlen == 64)
62 #define LW_UTIL_CPU_IS_64BIT 1
68 #define be_load_word32(ptr) \
69 ((((uint32_t)((ptr)[0])) << 24) | \
70 (((uint32_t)((ptr)[1])) << 16) | \
71 (((uint32_t)((ptr)[2])) << 8) | \
72 ((uint32_t)((ptr)[3])))
75 #define be_store_word32(ptr, x) \
78 (ptr)[0] = (uint8_t)(_x >> 24); \
79 (ptr)[1] = (uint8_t)(_x >> 16); \
80 (ptr)[2] = (uint8_t)(_x >> 8); \
81 (ptr)[3] = (uint8_t)_x; \
85 #define le_load_word32(ptr) \
86 ((((uint32_t)((ptr)[3])) << 24) | \
87 (((uint32_t)((ptr)[2])) << 16) | \
88 (((uint32_t)((ptr)[1])) << 8) | \
89 ((uint32_t)((ptr)[0])))
92 #define le_store_word32(ptr, x) \
95 (ptr)[0] = (uint8_t)_x; \
96 (ptr)[1] = (uint8_t)(_x >> 8); \
97 (ptr)[2] = (uint8_t)(_x >> 16); \
98 (ptr)[3] = (uint8_t)(_x >> 24); \
102 #define reverse_word32(x) \
103 (((x) >> 24) | (((x) >> 8) & 0x0000FF00U) | \
104 (((x) << 8) & 0x00FF0000U) | ((x) << 24))
107 #define be_load_word64(ptr) \
108 ((((uint64_t)((ptr)[0])) << 56) | \
109 (((uint64_t)((ptr)[1])) << 48) | \
110 (((uint64_t)((ptr)[2])) << 40) | \
111 (((uint64_t)((ptr)[3])) << 32) | \
112 (((uint64_t)((ptr)[4])) << 24) | \
113 (((uint64_t)((ptr)[5])) << 16) | \
114 (((uint64_t)((ptr)[6])) << 8) | \
115 ((uint64_t)((ptr)[7])))
118 #define be_store_word64(ptr, x) \
121 (ptr)[0] = (uint8_t)(_x >> 56); \
122 (ptr)[1] = (uint8_t)(_x >> 48); \
123 (ptr)[2] = (uint8_t)(_x >> 40); \
124 (ptr)[3] = (uint8_t)(_x >> 32); \
125 (ptr)[4] = (uint8_t)(_x >> 24); \
126 (ptr)[5] = (uint8_t)(_x >> 16); \
127 (ptr)[6] = (uint8_t)(_x >> 8); \
128 (ptr)[7] = (uint8_t)_x; \
132 #define le_load_word64(ptr) \
133 ((((uint64_t)((ptr)[7])) << 56) | \
134 (((uint64_t)((ptr)[6])) << 48) | \
135 (((uint64_t)((ptr)[5])) << 40) | \
136 (((uint64_t)((ptr)[4])) << 32) | \
137 (((uint64_t)((ptr)[3])) << 24) | \
138 (((uint64_t)((ptr)[2])) << 16) | \
139 (((uint64_t)((ptr)[1])) << 8) | \
140 ((uint64_t)((ptr)[0])))
143 #define le_store_word64(ptr, x) \
146 (ptr)[0] = (uint8_t)_x; \
147 (ptr)[1] = (uint8_t)(_x >> 8); \
148 (ptr)[2] = (uint8_t)(_x >> 16); \
149 (ptr)[3] = (uint8_t)(_x >> 24); \
150 (ptr)[4] = (uint8_t)(_x >> 32); \
151 (ptr)[5] = (uint8_t)(_x >> 40); \
152 (ptr)[6] = (uint8_t)(_x >> 48); \
153 (ptr)[7] = (uint8_t)(_x >> 56); \
157 #define be_load_word16(ptr) \
158 ((((uint16_t)((ptr)[0])) << 8) | \
159 ((uint16_t)((ptr)[1])))
162 #define be_store_word16(ptr, x) \
165 (ptr)[0] = (uint8_t)(_x >> 8); \
166 (ptr)[1] = (uint8_t)_x; \
170 #define le_load_word16(ptr) \
171 ((((uint16_t)((ptr)[1])) << 8) | \
172 ((uint16_t)((ptr)[0])))
175 #define le_store_word16(ptr, x) \
178 (ptr)[0] = (uint8_t)_x; \
179 (ptr)[1] = (uint8_t)(_x >> 8); \
183 #define lw_xor_block(dest, src, len) \
185 unsigned char *_dest = (dest); \
186 const unsigned char *_src = (src); \
187 unsigned _len = (len); \
189 *_dest++ ^= *_src++; \
195 #define lw_xor_block_2_src(dest, src1, src2, len) \
197 unsigned char *_dest = (dest); \
198 const unsigned char *_src1 = (src1); \
199 const unsigned char *_src2 = (src2); \
200 unsigned _len = (len); \
202 *_dest++ = *_src1++ ^ *_src2++; \
209 #define lw_xor_block_2_dest(dest2, dest, src, len) \
211 unsigned char *_dest2 = (dest2); \
212 unsigned char *_dest = (dest); \
213 const unsigned char *_src = (src); \
214 unsigned _len = (len); \
216 *_dest2++ = (*_dest++ ^= *_src++); \
223 #define lw_xor_block_copy_src(dest2, dest, src1, src2, len) \
225 unsigned char *_dest2 = (dest2); \
226 unsigned char *_dest = (dest); \
227 const unsigned char *_src1 = (src1); \
228 const unsigned char *_src2 = (src2); \
229 unsigned _len = (len); \
231 unsigned char _temp = *_src2++; \
233 *_dest++ = *_src1++ ^ _temp; \
241 #define lw_xor_block_swap(dest2, dest, src, len) \
243 unsigned char *_dest2 = (dest2); \
244 unsigned char *_dest = (dest); \
245 const unsigned char *_src = (src); \
246 unsigned _len = (len); \
248 unsigned char _temp = *_src++; \
249 *_dest2++ = *_dest ^ _temp; \
261 #define LW_CRYPTO_ROTATE32_COMPOSED 1
263 #define LW_CRYPTO_ROTATE32_COMPOSED 0
269 #define leftRotate(a, bits) \
271 uint32_t _temp = (a); \
272 (_temp << (bits)) | (_temp >> (32 - (bits))); \
276 #define rightRotate(a, bits) \
278 uint32_t _temp = (a); \
279 (_temp >> (bits)) | (_temp << (32 - (bits))); \
282 #if !LW_CRYPTO_ROTATE32_COMPOSED
286 #define leftRotate1(a) (leftRotate((a), 1))
287 #define leftRotate2(a) (leftRotate((a), 2))
288 #define leftRotate3(a) (leftRotate((a), 3))
289 #define leftRotate4(a) (leftRotate((a), 4))
290 #define leftRotate5(a) (leftRotate((a), 5))
291 #define leftRotate6(a) (leftRotate((a), 6))
292 #define leftRotate7(a) (leftRotate((a), 7))
293 #define leftRotate8(a) (leftRotate((a), 8))
294 #define leftRotate9(a) (leftRotate((a), 9))
295 #define leftRotate10(a) (leftRotate((a), 10))
296 #define leftRotate11(a) (leftRotate((a), 11))
297 #define leftRotate12(a) (leftRotate((a), 12))
298 #define leftRotate13(a) (leftRotate((a), 13))
299 #define leftRotate14(a) (leftRotate((a), 14))
300 #define leftRotate15(a) (leftRotate((a), 15))
301 #define leftRotate16(a) (leftRotate((a), 16))
302 #define leftRotate17(a) (leftRotate((a), 17))
303 #define leftRotate18(a) (leftRotate((a), 18))
304 #define leftRotate19(a) (leftRotate((a), 19))
305 #define leftRotate20(a) (leftRotate((a), 20))
306 #define leftRotate21(a) (leftRotate((a), 21))
307 #define leftRotate22(a) (leftRotate((a), 22))
308 #define leftRotate23(a) (leftRotate((a), 23))
309 #define leftRotate24(a) (leftRotate((a), 24))
310 #define leftRotate25(a) (leftRotate((a), 25))
311 #define leftRotate26(a) (leftRotate((a), 26))
312 #define leftRotate27(a) (leftRotate((a), 27))
313 #define leftRotate28(a) (leftRotate((a), 28))
314 #define leftRotate29(a) (leftRotate((a), 29))
315 #define leftRotate30(a) (leftRotate((a), 30))
316 #define leftRotate31(a) (leftRotate((a), 31))
320 #define rightRotate1(a) (rightRotate((a), 1))
321 #define rightRotate2(a) (rightRotate((a), 2))
322 #define rightRotate3(a) (rightRotate((a), 3))
323 #define rightRotate4(a) (rightRotate((a), 4))
324 #define rightRotate5(a) (rightRotate((a), 5))
325 #define rightRotate6(a) (rightRotate((a), 6))
326 #define rightRotate7(a) (rightRotate((a), 7))
327 #define rightRotate8(a) (rightRotate((a), 8))
328 #define rightRotate9(a) (rightRotate((a), 9))
329 #define rightRotate10(a) (rightRotate((a), 10))
330 #define rightRotate11(a) (rightRotate((a), 11))
331 #define rightRotate12(a) (rightRotate((a), 12))
332 #define rightRotate13(a) (rightRotate((a), 13))
333 #define rightRotate14(a) (rightRotate((a), 14))
334 #define rightRotate15(a) (rightRotate((a), 15))
335 #define rightRotate16(a) (rightRotate((a), 16))
336 #define rightRotate17(a) (rightRotate((a), 17))
337 #define rightRotate18(a) (rightRotate((a), 18))
338 #define rightRotate19(a) (rightRotate((a), 19))
339 #define rightRotate20(a) (rightRotate((a), 20))
340 #define rightRotate21(a) (rightRotate((a), 21))
341 #define rightRotate22(a) (rightRotate((a), 22))
342 #define rightRotate23(a) (rightRotate((a), 23))
343 #define rightRotate24(a) (rightRotate((a), 24))
344 #define rightRotate25(a) (rightRotate((a), 25))
345 #define rightRotate26(a) (rightRotate((a), 26))
346 #define rightRotate27(a) (rightRotate((a), 27))
347 #define rightRotate28(a) (rightRotate((a), 28))
348 #define rightRotate29(a) (rightRotate((a), 29))
349 #define rightRotate30(a) (rightRotate((a), 30))
350 #define rightRotate31(a) (rightRotate((a), 31))
357 #define leftRotate1(a) (leftRotate((a), 1))
360 #define leftRotate2(a) (leftRotate(leftRotate((a), 1), 1))
363 #define leftRotate3(a) (leftRotate(leftRotate(leftRotate((a), 1), 1), 1))
366 #define leftRotate4(a) (leftRotate(leftRotate(leftRotate(leftRotate((a), 1), 1), 1), 1))
369 #define leftRotate5(a) (rightRotate(rightRotate(rightRotate(leftRotate((a), 8), 1), 1), 1))
372 #define leftRotate6(a) (rightRotate(rightRotate(leftRotate((a), 8), 1), 1))
375 #define leftRotate7(a) (rightRotate(leftRotate((a), 8), 1))
378 #define leftRotate8(a) (leftRotate((a), 8))
381 #define leftRotate9(a) (leftRotate(leftRotate((a), 8), 1))
384 #define leftRotate10(a) (leftRotate(leftRotate(leftRotate((a), 8), 1), 1))
387 #define leftRotate11(a) (leftRotate(leftRotate(leftRotate(leftRotate((a), 8), 1), 1), 1))
390 #define leftRotate12(a) (rightRotate(rightRotate(rightRotate(rightRotate(leftRotate((a), 16), 1), 1), 1), 1))
393 #define leftRotate13(a) (rightRotate(rightRotate(rightRotate(leftRotate((a), 16), 1), 1), 1))
396 #define leftRotate14(a) (rightRotate(rightRotate(leftRotate((a), 16), 1), 1))
399 #define leftRotate15(a) (rightRotate(leftRotate((a), 16), 1))
402 #define leftRotate16(a) (leftRotate((a), 16))
405 #define leftRotate17(a) (leftRotate(leftRotate((a), 16), 1))
408 #define leftRotate18(a) (leftRotate(leftRotate(leftRotate((a), 16), 1), 1))
411 #define leftRotate19(a) (leftRotate(leftRotate(leftRotate(leftRotate((a), 16), 1), 1), 1))
414 #define leftRotate20(a) (leftRotate(leftRotate(leftRotate(leftRotate(leftRotate((a), 16), 1), 1), 1), 1))
417 #define leftRotate21(a) (rightRotate(rightRotate(rightRotate(leftRotate((a), 24), 1), 1), 1))
420 #define leftRotate22(a) (rightRotate(rightRotate(leftRotate((a), 24), 1), 1))
423 #define leftRotate23(a) (rightRotate(leftRotate((a), 24), 1))
426 #define leftRotate24(a) (leftRotate((a), 24))
429 #define leftRotate25(a) (leftRotate(leftRotate((a), 24), 1))
432 #define leftRotate26(a) (leftRotate(leftRotate(leftRotate((a), 24), 1), 1))
435 #define leftRotate27(a) (leftRotate(leftRotate(leftRotate(leftRotate((a), 24), 1), 1), 1))
438 #define leftRotate28(a) (rightRotate(rightRotate(rightRotate(rightRotate((a), 1), 1), 1), 1))
441 #define leftRotate29(a) (rightRotate(rightRotate(rightRotate((a), 1), 1), 1))
444 #define leftRotate30(a) (rightRotate(rightRotate((a), 1), 1))
447 #define leftRotate31(a) (rightRotate((a), 1))
450 #define rightRotate1(a) (leftRotate31((a)))
451 #define rightRotate2(a) (leftRotate30((a)))
452 #define rightRotate3(a) (leftRotate29((a)))
453 #define rightRotate4(a) (leftRotate28((a)))
454 #define rightRotate5(a) (leftRotate27((a)))
455 #define rightRotate6(a) (leftRotate26((a)))
456 #define rightRotate7(a) (leftRotate25((a)))
457 #define rightRotate8(a) (leftRotate24((a)))
458 #define rightRotate9(a) (leftRotate23((a)))
459 #define rightRotate10(a) (leftRotate22((a)))
460 #define rightRotate11(a) (leftRotate21((a)))
461 #define rightRotate12(a) (leftRotate20((a)))
462 #define rightRotate13(a) (leftRotate19((a)))
463 #define rightRotate14(a) (leftRotate18((a)))
464 #define rightRotate15(a) (leftRotate17((a)))
465 #define rightRotate16(a) (leftRotate16((a)))
466 #define rightRotate17(a) (leftRotate15((a)))
467 #define rightRotate18(a) (leftRotate14((a)))
468 #define rightRotate19(a) (leftRotate13((a)))
469 #define rightRotate20(a) (leftRotate12((a)))
470 #define rightRotate21(a) (leftRotate11((a)))
471 #define rightRotate22(a) (leftRotate10((a)))
472 #define rightRotate23(a) (leftRotate9((a)))
473 #define rightRotate24(a) (leftRotate8((a)))
474 #define rightRotate25(a) (leftRotate7((a)))
475 #define rightRotate26(a) (leftRotate6((a)))
476 #define rightRotate27(a) (leftRotate5((a)))
477 #define rightRotate28(a) (leftRotate4((a)))
478 #define rightRotate29(a) (leftRotate3((a)))
479 #define rightRotate30(a) (leftRotate2((a)))
480 #define rightRotate31(a) (leftRotate1((a)))
487 #define leftRotate_64(a, bits) \
489 uint64_t _temp = (a); \
490 (_temp << (bits)) | (_temp >> (64 - (bits))); \
494 #define rightRotate_64(a, bits) \
496 uint64_t _temp = (a); \
497 (_temp >> (bits)) | (_temp << (64 - (bits))); \
502 #define leftRotate1_64(a) (leftRotate_64((a), 1))
503 #define leftRotate2_64(a) (leftRotate_64((a), 2))
504 #define leftRotate3_64(a) (leftRotate_64((a), 3))
505 #define leftRotate4_64(a) (leftRotate_64((a), 4))
506 #define leftRotate5_64(a) (leftRotate_64((a), 5))
507 #define leftRotate6_64(a) (leftRotate_64((a), 6))
508 #define leftRotate7_64(a) (leftRotate_64((a), 7))
509 #define leftRotate8_64(a) (leftRotate_64((a), 8))
510 #define leftRotate9_64(a) (leftRotate_64((a), 9))
511 #define leftRotate10_64(a) (leftRotate_64((a), 10))
512 #define leftRotate11_64(a) (leftRotate_64((a), 11))
513 #define leftRotate12_64(a) (leftRotate_64((a), 12))
514 #define leftRotate13_64(a) (leftRotate_64((a), 13))
515 #define leftRotate14_64(a) (leftRotate_64((a), 14))
516 #define leftRotate15_64(a) (leftRotate_64((a), 15))
517 #define leftRotate16_64(a) (leftRotate_64((a), 16))
518 #define leftRotate17_64(a) (leftRotate_64((a), 17))
519 #define leftRotate18_64(a) (leftRotate_64((a), 18))
520 #define leftRotate19_64(a) (leftRotate_64((a), 19))
521 #define leftRotate20_64(a) (leftRotate_64((a), 20))
522 #define leftRotate21_64(a) (leftRotate_64((a), 21))
523 #define leftRotate22_64(a) (leftRotate_64((a), 22))
524 #define leftRotate23_64(a) (leftRotate_64((a), 23))
525 #define leftRotate24_64(a) (leftRotate_64((a), 24))
526 #define leftRotate25_64(a) (leftRotate_64((a), 25))
527 #define leftRotate26_64(a) (leftRotate_64((a), 26))
528 #define leftRotate27_64(a) (leftRotate_64((a), 27))
529 #define leftRotate28_64(a) (leftRotate_64((a), 28))
530 #define leftRotate29_64(a) (leftRotate_64((a), 29))
531 #define leftRotate30_64(a) (leftRotate_64((a), 30))
532 #define leftRotate31_64(a) (leftRotate_64((a), 31))
533 #define leftRotate32_64(a) (leftRotate_64((a), 32))
534 #define leftRotate33_64(a) (leftRotate_64((a), 33))
535 #define leftRotate34_64(a) (leftRotate_64((a), 34))
536 #define leftRotate35_64(a) (leftRotate_64((a), 35))
537 #define leftRotate36_64(a) (leftRotate_64((a), 36))
538 #define leftRotate37_64(a) (leftRotate_64((a), 37))
539 #define leftRotate38_64(a) (leftRotate_64((a), 38))
540 #define leftRotate39_64(a) (leftRotate_64((a), 39))
541 #define leftRotate40_64(a) (leftRotate_64((a), 40))
542 #define leftRotate41_64(a) (leftRotate_64((a), 41))
543 #define leftRotate42_64(a) (leftRotate_64((a), 42))
544 #define leftRotate43_64(a) (leftRotate_64((a), 43))
545 #define leftRotate44_64(a) (leftRotate_64((a), 44))
546 #define leftRotate45_64(a) (leftRotate_64((a), 45))
547 #define leftRotate46_64(a) (leftRotate_64((a), 46))
548 #define leftRotate47_64(a) (leftRotate_64((a), 47))
549 #define leftRotate48_64(a) (leftRotate_64((a), 48))
550 #define leftRotate49_64(a) (leftRotate_64((a), 49))
551 #define leftRotate50_64(a) (leftRotate_64((a), 50))
552 #define leftRotate51_64(a) (leftRotate_64((a), 51))
553 #define leftRotate52_64(a) (leftRotate_64((a), 52))
554 #define leftRotate53_64(a) (leftRotate_64((a), 53))
555 #define leftRotate54_64(a) (leftRotate_64((a), 54))
556 #define leftRotate55_64(a) (leftRotate_64((a), 55))
557 #define leftRotate56_64(a) (leftRotate_64((a), 56))
558 #define leftRotate57_64(a) (leftRotate_64((a), 57))
559 #define leftRotate58_64(a) (leftRotate_64((a), 58))
560 #define leftRotate59_64(a) (leftRotate_64((a), 59))
561 #define leftRotate60_64(a) (leftRotate_64((a), 60))
562 #define leftRotate61_64(a) (leftRotate_64((a), 61))
563 #define leftRotate62_64(a) (leftRotate_64((a), 62))
564 #define leftRotate63_64(a) (leftRotate_64((a), 63))
568 #define rightRotate1_64(a) (rightRotate_64((a), 1))
569 #define rightRotate2_64(a) (rightRotate_64((a), 2))
570 #define rightRotate3_64(a) (rightRotate_64((a), 3))
571 #define rightRotate4_64(a) (rightRotate_64((a), 4))
572 #define rightRotate5_64(a) (rightRotate_64((a), 5))
573 #define rightRotate6_64(a) (rightRotate_64((a), 6))
574 #define rightRotate7_64(a) (rightRotate_64((a), 7))
575 #define rightRotate8_64(a) (rightRotate_64((a), 8))
576 #define rightRotate9_64(a) (rightRotate_64((a), 9))
577 #define rightRotate10_64(a) (rightRotate_64((a), 10))
578 #define rightRotate11_64(a) (rightRotate_64((a), 11))
579 #define rightRotate12_64(a) (rightRotate_64((a), 12))
580 #define rightRotate13_64(a) (rightRotate_64((a), 13))
581 #define rightRotate14_64(a) (rightRotate_64((a), 14))
582 #define rightRotate15_64(a) (rightRotate_64((a), 15))
583 #define rightRotate16_64(a) (rightRotate_64((a), 16))
584 #define rightRotate17_64(a) (rightRotate_64((a), 17))
585 #define rightRotate18_64(a) (rightRotate_64((a), 18))
586 #define rightRotate19_64(a) (rightRotate_64((a), 19))
587 #define rightRotate20_64(a) (rightRotate_64((a), 20))
588 #define rightRotate21_64(a) (rightRotate_64((a), 21))
589 #define rightRotate22_64(a) (rightRotate_64((a), 22))
590 #define rightRotate23_64(a) (rightRotate_64((a), 23))
591 #define rightRotate24_64(a) (rightRotate_64((a), 24))
592 #define rightRotate25_64(a) (rightRotate_64((a), 25))
593 #define rightRotate26_64(a) (rightRotate_64((a), 26))
594 #define rightRotate27_64(a) (rightRotate_64((a), 27))
595 #define rightRotate28_64(a) (rightRotate_64((a), 28))
596 #define rightRotate29_64(a) (rightRotate_64((a), 29))
597 #define rightRotate30_64(a) (rightRotate_64((a), 30))
598 #define rightRotate31_64(a) (rightRotate_64((a), 31))
599 #define rightRotate32_64(a) (rightRotate_64((a), 32))
600 #define rightRotate33_64(a) (rightRotate_64((a), 33))
601 #define rightRotate34_64(a) (rightRotate_64((a), 34))
602 #define rightRotate35_64(a) (rightRotate_64((a), 35))
603 #define rightRotate36_64(a) (rightRotate_64((a), 36))
604 #define rightRotate37_64(a) (rightRotate_64((a), 37))
605 #define rightRotate38_64(a) (rightRotate_64((a), 38))
606 #define rightRotate39_64(a) (rightRotate_64((a), 39))
607 #define rightRotate40_64(a) (rightRotate_64((a), 40))
608 #define rightRotate41_64(a) (rightRotate_64((a), 41))
609 #define rightRotate42_64(a) (rightRotate_64((a), 42))
610 #define rightRotate43_64(a) (rightRotate_64((a), 43))
611 #define rightRotate44_64(a) (rightRotate_64((a), 44))
612 #define rightRotate45_64(a) (rightRotate_64((a), 45))
613 #define rightRotate46_64(a) (rightRotate_64((a), 46))
614 #define rightRotate47_64(a) (rightRotate_64((a), 47))
615 #define rightRotate48_64(a) (rightRotate_64((a), 48))
616 #define rightRotate49_64(a) (rightRotate_64((a), 49))
617 #define rightRotate50_64(a) (rightRotate_64((a), 50))
618 #define rightRotate51_64(a) (rightRotate_64((a), 51))
619 #define rightRotate52_64(a) (rightRotate_64((a), 52))
620 #define rightRotate53_64(a) (rightRotate_64((a), 53))
621 #define rightRotate54_64(a) (rightRotate_64((a), 54))
622 #define rightRotate55_64(a) (rightRotate_64((a), 55))
623 #define rightRotate56_64(a) (rightRotate_64((a), 56))
624 #define rightRotate57_64(a) (rightRotate_64((a), 57))
625 #define rightRotate58_64(a) (rightRotate_64((a), 58))
626 #define rightRotate59_64(a) (rightRotate_64((a), 59))
627 #define rightRotate60_64(a) (rightRotate_64((a), 60))
628 #define rightRotate61_64(a) (rightRotate_64((a), 61))
629 #define rightRotate62_64(a) (rightRotate_64((a), 62))
630 #define rightRotate63_64(a) (rightRotate_64((a), 63))
633 #define leftRotate_16(a, bits) \
635 uint16_t _temp = (a); \
636 (_temp << (bits)) | (_temp >> (16 - (bits))); \
640 #define rightRotate_16(a, bits) \
642 uint16_t _temp = (a); \
643 (_temp >> (bits)) | (_temp << (16 - (bits))); \
648 #define leftRotate1_16(a) (leftRotate_16((a), 1))
649 #define leftRotate2_16(a) (leftRotate_16((a), 2))
650 #define leftRotate3_16(a) (leftRotate_16((a), 3))
651 #define leftRotate4_16(a) (leftRotate_16((a), 4))
652 #define leftRotate5_16(a) (leftRotate_16((a), 5))
653 #define leftRotate6_16(a) (leftRotate_16((a), 6))
654 #define leftRotate7_16(a) (leftRotate_16((a), 7))
655 #define leftRotate8_16(a) (leftRotate_16((a), 8))
656 #define leftRotate9_16(a) (leftRotate_16((a), 9))
657 #define leftRotate10_16(a) (leftRotate_16((a), 10))
658 #define leftRotate11_16(a) (leftRotate_16((a), 11))
659 #define leftRotate12_16(a) (leftRotate_16((a), 12))
660 #define leftRotate13_16(a) (leftRotate_16((a), 13))
661 #define leftRotate14_16(a) (leftRotate_16((a), 14))
662 #define leftRotate15_16(a) (leftRotate_16((a), 15))
666 #define rightRotate1_16(a) (rightRotate_16((a), 1))
667 #define rightRotate2_16(a) (rightRotate_16((a), 2))
668 #define rightRotate3_16(a) (rightRotate_16((a), 3))
669 #define rightRotate4_16(a) (rightRotate_16((a), 4))
670 #define rightRotate5_16(a) (rightRotate_16((a), 5))
671 #define rightRotate6_16(a) (rightRotate_16((a), 6))
672 #define rightRotate7_16(a) (rightRotate_16((a), 7))
673 #define rightRotate8_16(a) (rightRotate_16((a), 8))
674 #define rightRotate9_16(a) (rightRotate_16((a), 9))
675 #define rightRotate10_16(a) (rightRotate_16((a), 10))
676 #define rightRotate11_16(a) (rightRotate_16((a), 11))
677 #define rightRotate12_16(a) (rightRotate_16((a), 12))
678 #define rightRotate13_16(a) (rightRotate_16((a), 13))
679 #define rightRotate14_16(a) (rightRotate_16((a), 14))
680 #define rightRotate15_16(a) (rightRotate_16((a), 15))
683 #define leftRotate_8(a, bits) \
685 uint8_t _temp = (a); \
686 (_temp << (bits)) | (_temp >> (8 - (bits))); \
690 #define rightRotate_8(a, bits) \
692 uint8_t _temp = (a); \
693 (_temp >> (bits)) | (_temp << (8 - (bits))); \
698 #define leftRotate1_8(a) (leftRotate_8((a), 1))
699 #define leftRotate2_8(a) (leftRotate_8((a), 2))
700 #define leftRotate3_8(a) (leftRotate_8((a), 3))
701 #define leftRotate4_8(a) (leftRotate_8((a), 4))
702 #define leftRotate5_8(a) (leftRotate_8((a), 5))
703 #define leftRotate6_8(a) (leftRotate_8((a), 6))
704 #define leftRotate7_8(a) (leftRotate_8((a), 7))
708 #define rightRotate1_8(a) (rightRotate_8((a), 1))
709 #define rightRotate2_8(a) (rightRotate_8((a), 2))
710 #define rightRotate3_8(a) (rightRotate_8((a), 3))
711 #define rightRotate4_8(a) (rightRotate_8((a), 4))
712 #define rightRotate5_8(a) (rightRotate_8((a), 5))
713 #define rightRotate6_8(a) (rightRotate_8((a), 6))
714 #define rightRotate7_8(a) (rightRotate_8((a), 7))