blob: 59311a6201d7559a33a5ae9a1436dcd9eaf2c982 (
plain)
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
|
/* Added for Tor. */
#ifndef CRYPTO_INT32_H
#define CRYPTO_INT32_H
#include "common/torint.h"
#define crypto_int32 int32_t
#define crypto_uint32 uint32_t
/*
Stop signed left shifts overflowing
by using unsigned types for bitwise operations
*/
#ifndef OVERFLOW_SAFE_SIGNED_LSHIFT
#define OVERFLOW_SAFE_SIGNED_LSHIFT(s, lshift, utype, stype) \
((stype)((utype)(s) << (utype)(lshift)))
#endif
#define SHL32(s, lshift) \
OVERFLOW_SAFE_SIGNED_LSHIFT(s, lshift, crypto_uint32, crypto_int32)
#define SHL8(s, lshift) \
OVERFLOW_SAFE_SIGNED_LSHIFT(s, lshift, unsigned char, signed char)
#endif /* CRYPTO_INT32_H */
|