aboutsummaryrefslogtreecommitdiff
path: root/src/ext/ed25519/ref10/crypto_int64.h
blob: 46e8852ed06cf7bad830d54a5582d48b602c61e0 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
/* Added for Tor. */

#ifndef CRYPTO_INT64_H
#define CRYPTO_INT64_H

#include "torint.h"
#define crypto_int64 int64_t
#define crypto_uint64 uint64_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 SHL64(s, lshift) \
  OVERFLOW_SAFE_SIGNED_LSHIFT(s, lshift, crypto_uint64, crypto_int64)

#endif /* CRYPTO_INT64_H */