crypto_int64.h 526 B

1234567891011121314151617181920212223
  1. /* Added for Tor. */
  2. #ifndef CRYPTO_INT64_H
  3. #define CRYPTO_INT64_H
  4. #include "lib/cc/torint.h"
  5. #define crypto_int64 int64_t
  6. #define crypto_uint64 uint64_t
  7. /*
  8. Stop signed left shifts overflowing
  9. by using unsigned types for bitwise operations
  10. */
  11. #ifndef OVERFLOW_SAFE_SIGNED_LSHIFT
  12. #define OVERFLOW_SAFE_SIGNED_LSHIFT(s, lshift, utype, stype) \
  13. ((stype)((utype)(s) << (utype)(lshift)))
  14. #endif
  15. #define SHL64(s, lshift) \
  16. OVERFLOW_SAFE_SIGNED_LSHIFT(s, lshift, crypto_uint64, crypto_int64)
  17. #endif /* CRYPTO_INT64_H */