diff options
Diffstat (limited to '3rd_party/ed25519/fixedint.h')
-rw-r--r-- | 3rd_party/ed25519/fixedint.h | 72 |
1 files changed, 72 insertions, 0 deletions
diff --git a/3rd_party/ed25519/fixedint.h b/3rd_party/ed25519/fixedint.h new file mode 100644 index 0000000..1a8745b --- /dev/null +++ b/3rd_party/ed25519/fixedint.h | |||
@@ -0,0 +1,72 @@ | |||
1 | /* | ||
2 | Portable header to provide the 32 and 64 bits type. | ||
3 | |||
4 | Not a compatible replacement for <stdint.h>, do not blindly use it as such. | ||
5 | */ | ||
6 | |||
7 | #if ((defined(__STDC__) && __STDC__ && __STDC_VERSION__ >= 199901L) || (defined(__WATCOMC__) && (defined(_STDINT_H_INCLUDED) || __WATCOMC__ >= 1250)) || (defined(__GNUC__) && (defined(_STDINT_H) || defined(_STDINT_H_) || defined(__UINT_FAST64_TYPE__)) )) && !defined(FIXEDINT_H_INCLUDED) | ||
8 | #include <stdint.h> | ||
9 | #define FIXEDINT_H_INCLUDED | ||
10 | |||
11 | #if defined(__WATCOMC__) && __WATCOMC__ >= 1250 && !defined(UINT64_C) | ||
12 | #include <limits.h> | ||
13 | #define UINT64_C(x) (x + (UINT64_MAX - UINT64_MAX)) | ||
14 | #endif | ||
15 | #endif | ||
16 | |||
17 | |||
18 | #ifndef FIXEDINT_H_INCLUDED | ||
19 | #define FIXEDINT_H_INCLUDED | ||
20 | |||
21 | #include <limits.h> | ||
22 | |||
23 | /* (u)int32_t */ | ||
24 | #ifndef uint32_t | ||
25 | #if (ULONG_MAX == 0xffffffffUL) | ||
26 | typedef unsigned long uint32_t; | ||
27 | #elif (UINT_MAX == 0xffffffffUL) | ||
28 | typedef unsigned int uint32_t; | ||
29 | #elif (USHRT_MAX == 0xffffffffUL) | ||
30 | typedef unsigned short uint32_t; | ||
31 | #endif | ||
32 | #endif | ||
33 | |||
34 | |||
35 | #ifndef int32_t | ||
36 | #if (LONG_MAX == 0x7fffffffL) | ||
37 | typedef signed long int32_t; | ||
38 | #elif (INT_MAX == 0x7fffffffL) | ||
39 | typedef signed int int32_t; | ||
40 | #elif (SHRT_MAX == 0x7fffffffL) | ||
41 | typedef signed short int32_t; | ||
42 | #endif | ||
43 | #endif | ||
44 | |||
45 | |||
46 | /* (u)int64_t */ | ||
47 | #if (defined(__STDC__) && defined(__STDC_VERSION__) && __STDC__ && __STDC_VERSION__ >= 199901L) | ||
48 | typedef long long int64_t; | ||
49 | typedef unsigned long long uint64_t; | ||
50 | |||
51 | #define UINT64_C(v) v ##ULL | ||
52 | #define INT64_C(v) v ##LL | ||
53 | #elif defined(__GNUC__) | ||
54 | __extension__ typedef long long int64_t; | ||
55 | __extension__ typedef unsigned long long uint64_t; | ||
56 | |||
57 | #define UINT64_C(v) v ##ULL | ||
58 | #define INT64_C(v) v ##LL | ||
59 | #elif defined(__MWERKS__) || defined(__SUNPRO_C) || defined(__SUNPRO_CC) || defined(__APPLE_CC__) || defined(_LONG_LONG) || defined(_CRAYC) | ||
60 | typedef long long int64_t; | ||
61 | typedef unsigned long long uint64_t; | ||
62 | |||
63 | #define UINT64_C(v) v ##ULL | ||
64 | #define INT64_C(v) v ##LL | ||
65 | #elif (defined(__WATCOMC__) && defined(__WATCOM_INT64__)) || (defined(_MSC_VER) && _INTEGRAL_MAX_BITS >= 64) || (defined(__BORLANDC__) && __BORLANDC__ > 0x460) || defined(__alpha) || defined(__DECC) | ||
66 | typedef __int64 int64_t; | ||
67 | typedef unsigned __int64 uint64_t; | ||
68 | |||
69 | #define UINT64_C(v) v ##UI64 | ||
70 | #define INT64_C(v) v ##I64 | ||
71 | #endif | ||
72 | #endif | ||