crypto_int32.h (621B)
1 /* Added for Tor. */ 2 3 #ifndef CRYPTO_INT32_H 4 #define CRYPTO_INT32_H 5 6 #include "lib/cc/torint.h" 7 #define crypto_int32 int32_t 8 #define crypto_uint32 uint32_t 9 10 /* 11 Stop signed left shifts overflowing 12 by using unsigned types for bitwise operations 13 */ 14 15 #ifndef OVERFLOW_SAFE_SIGNED_LSHIFT 16 #define OVERFLOW_SAFE_SIGNED_LSHIFT(s, lshift, utype, stype) \ 17 ((stype)((utype)(s) << (utype)(lshift))) 18 #endif 19 20 #define SHL32(s, lshift) \ 21 OVERFLOW_SAFE_SIGNED_LSHIFT(s, lshift, crypto_uint32, crypto_int32) 22 #define SHL8(s, lshift) \ 23 OVERFLOW_SAFE_SIGNED_LSHIFT(s, lshift, unsigned char, signed char) 24 25 #endif /* CRYPTO_INT32_H */