|
| 1 | +/* ecrypt-config.h */ |
| 2 | + |
| 3 | +/* *** Normally, it should not be necessary to edit this file. *** */ |
| 4 | + |
| 5 | +#ifndef ECRYPT_CONFIG |
| 6 | +#define ECRYPT_CONFIG |
| 7 | + |
| 8 | +/* ------------------------------------------------------------------------- */ |
| 9 | + |
| 10 | +/* Guess the endianness of the target architecture. */ |
| 11 | + |
| 12 | +/* |
| 13 | + * The LITTLE endian machines: |
| 14 | + */ |
| 15 | +#if defined(__ultrix) /* Older MIPS */ |
| 16 | +#define ECRYPT_LITTLE_ENDIAN |
| 17 | +#elif defined(__alpha) /* Alpha */ |
| 18 | +#define ECRYPT_LITTLE_ENDIAN |
| 19 | +#elif defined(i386) /* x86 (gcc) */ |
| 20 | +#define ECRYPT_LITTLE_ENDIAN |
| 21 | +#elif defined(__i386) /* x86 (gcc) */ |
| 22 | +#define ECRYPT_LITTLE_ENDIAN |
| 23 | +#elif defined(_M_IX86) /* x86 (MSC, Borland) */ |
| 24 | +#define ECRYPT_LITTLE_ENDIAN |
| 25 | +#elif defined(_MSC_VER) /* x86 (surely MSC) */ |
| 26 | +#define ECRYPT_LITTLE_ENDIAN |
| 27 | +#elif defined(__INTEL_COMPILER) /* x86 (surely Intel compiler icl.exe) */ |
| 28 | +#define ECRYPT_LITTLE_ENDIAN |
| 29 | + |
| 30 | +/* |
| 31 | + * The BIG endian machines: |
| 32 | + */ |
| 33 | +#elif defined(sun) /* Newer Sparc's */ |
| 34 | +#define ECRYPT_BIG_ENDIAN |
| 35 | +#elif defined(__ppc__) /* PowerPC */ |
| 36 | +#define ECRYPT_BIG_ENDIAN |
| 37 | + |
| 38 | +/* |
| 39 | + * Finally machines with UNKNOWN endianness: |
| 40 | + */ |
| 41 | +#elif defined (_AIX) /* RS6000 */ |
| 42 | +#define ECRYPT_UNKNOWN |
| 43 | +#elif defined(__hpux) /* HP-PA */ |
| 44 | +#define ECRYPT_UNKNOWN |
| 45 | +#elif defined(__aux) /* 68K */ |
| 46 | +#define ECRYPT_UNKNOWN |
| 47 | +#elif defined(__dgux) /* 88K (but P6 in latest boxes) */ |
| 48 | +#define ECRYPT_UNKNOWN |
| 49 | +#elif defined(__sgi) /* Newer MIPS */ |
| 50 | +#define ECRYPT_UNKNOWN |
| 51 | +#else /* Any other processor */ |
| 52 | +#define ECRYPT_UNKNOWN |
| 53 | +#endif |
| 54 | + |
| 55 | +/* ------------------------------------------------------------------------- */ |
| 56 | + |
| 57 | +/* |
| 58 | + * Find minimal-width types to store 8-bit, 16-bit, 32-bit, and 64-bit |
| 59 | + * integers. |
| 60 | + * |
| 61 | + * Note: to enable 64-bit types on 32-bit compilers, it might be |
| 62 | + * necessary to switch from ISO C90 mode to ISO C99 mode (e.g., gcc |
| 63 | + * -std=c99). |
| 64 | + */ |
| 65 | + |
| 66 | +#include <limits.h> |
| 67 | + |
| 68 | +/* --- check char --- */ |
| 69 | + |
| 70 | +#if (UCHAR_MAX / 0xFU > 0xFU) |
| 71 | +#ifndef I8T |
| 72 | +#define I8T char |
| 73 | +#define U8C(v) (v##U) |
| 74 | + |
| 75 | +#if (UCHAR_MAX == 0xFFU) |
| 76 | +#define ECRYPT_I8T_IS_BYTE |
| 77 | +#endif |
| 78 | + |
| 79 | +#endif |
| 80 | + |
| 81 | +#if (UCHAR_MAX / 0xFFU > 0xFFU) |
| 82 | +#ifndef I16T |
| 83 | +#define I16T char |
| 84 | +#define U16C(v) (v##U) |
| 85 | +#endif |
| 86 | + |
| 87 | +#if (UCHAR_MAX / 0xFFFFU > 0xFFFFU) |
| 88 | +#ifndef I32T |
| 89 | +#define I32T char |
| 90 | +#define U32C(v) (v##U) |
| 91 | +#endif |
| 92 | + |
| 93 | +#if (UCHAR_MAX / 0xFFFFFFFFU > 0xFFFFFFFFU) |
| 94 | +#ifndef I64T |
| 95 | +#define I64T char |
| 96 | +#define U64C(v) (v##U) |
| 97 | +#define ECRYPT_NATIVE64 |
| 98 | +#endif |
| 99 | + |
| 100 | +#endif |
| 101 | +#endif |
| 102 | +#endif |
| 103 | +#endif |
| 104 | + |
| 105 | +/* --- check short --- */ |
| 106 | + |
| 107 | +#if (USHRT_MAX / 0xFU > 0xFU) |
| 108 | +#ifndef I8T |
| 109 | +#define I8T short |
| 110 | +#define U8C(v) (v##U) |
| 111 | + |
| 112 | +#if (USHRT_MAX == 0xFFU) |
| 113 | +#define ECRYPT_I8T_IS_BYTE |
| 114 | +#endif |
| 115 | + |
| 116 | +#endif |
| 117 | + |
| 118 | +#if (USHRT_MAX / 0xFFU > 0xFFU) |
| 119 | +#ifndef I16T |
| 120 | +#define I16T short |
| 121 | +#define U16C(v) (v##U) |
| 122 | +#endif |
| 123 | + |
| 124 | +#if (USHRT_MAX / 0xFFFFU > 0xFFFFU) |
| 125 | +#ifndef I32T |
| 126 | +#define I32T short |
| 127 | +#define U32C(v) (v##U) |
| 128 | +#endif |
| 129 | + |
| 130 | +#if (USHRT_MAX / 0xFFFFFFFFU > 0xFFFFFFFFU) |
| 131 | +#ifndef I64T |
| 132 | +#define I64T short |
| 133 | +#define U64C(v) (v##U) |
| 134 | +#define ECRYPT_NATIVE64 |
| 135 | +#endif |
| 136 | + |
| 137 | +#endif |
| 138 | +#endif |
| 139 | +#endif |
| 140 | +#endif |
| 141 | + |
| 142 | +/* --- check int --- */ |
| 143 | + |
| 144 | +#if (UINT_MAX / 0xFU > 0xFU) |
| 145 | +#ifndef I8T |
| 146 | +#define I8T int |
| 147 | +#define U8C(v) (v##U) |
| 148 | + |
| 149 | +#if (ULONG_MAX == 0xFFU) |
| 150 | +#define ECRYPT_I8T_IS_BYTE |
| 151 | +#endif |
| 152 | + |
| 153 | +#endif |
| 154 | + |
| 155 | +#if (UINT_MAX / 0xFFU > 0xFFU) |
| 156 | +#ifndef I16T |
| 157 | +#define I16T int |
| 158 | +#define U16C(v) (v##U) |
| 159 | +#endif |
| 160 | + |
| 161 | +#if (UINT_MAX / 0xFFFFU > 0xFFFFU) |
| 162 | +#ifndef I32T |
| 163 | +#define I32T int |
| 164 | +#define U32C(v) (v##U) |
| 165 | +#endif |
| 166 | + |
| 167 | +#if (UINT_MAX / 0xFFFFFFFFU > 0xFFFFFFFFU) |
| 168 | +#ifndef I64T |
| 169 | +#define I64T int |
| 170 | +#define U64C(v) (v##U) |
| 171 | +#define ECRYPT_NATIVE64 |
| 172 | +#endif |
| 173 | + |
| 174 | +#endif |
| 175 | +#endif |
| 176 | +#endif |
| 177 | +#endif |
| 178 | + |
| 179 | +/* --- check long --- */ |
| 180 | + |
| 181 | +#if (ULONG_MAX / 0xFUL > 0xFUL) |
| 182 | +#ifndef I8T |
| 183 | +#define I8T long |
| 184 | +#define U8C(v) (v##UL) |
| 185 | + |
| 186 | +#if (ULONG_MAX == 0xFFUL) |
| 187 | +#define ECRYPT_I8T_IS_BYTE |
| 188 | +#endif |
| 189 | + |
| 190 | +#endif |
| 191 | + |
| 192 | +#if (ULONG_MAX / 0xFFUL > 0xFFUL) |
| 193 | +#ifndef I16T |
| 194 | +#define I16T long |
| 195 | +#define U16C(v) (v##UL) |
| 196 | +#endif |
| 197 | + |
| 198 | +#if (ULONG_MAX / 0xFFFFUL > 0xFFFFUL) |
| 199 | +#ifndef I32T |
| 200 | +#define I32T long |
| 201 | +#define U32C(v) (v##UL) |
| 202 | +#endif |
| 203 | + |
| 204 | +#if (ULONG_MAX / 0xFFFFFFFFUL > 0xFFFFFFFFUL) |
| 205 | +#ifndef I64T |
| 206 | +#define I64T long |
| 207 | +#define U64C(v) (v##UL) |
| 208 | +#define ECRYPT_NATIVE64 |
| 209 | +#endif |
| 210 | + |
| 211 | +#endif |
| 212 | +#endif |
| 213 | +#endif |
| 214 | +#endif |
| 215 | + |
| 216 | +/* --- check long long --- */ |
| 217 | + |
| 218 | +#ifdef ULLONG_MAX |
| 219 | + |
| 220 | +#if (ULLONG_MAX / 0xFULL > 0xFULL) |
| 221 | +#ifndef I8T |
| 222 | +#define I8T long long |
| 223 | +#define U8C(v) (v##ULL) |
| 224 | + |
| 225 | +#if (ULLONG_MAX == 0xFFULL) |
| 226 | +#define ECRYPT_I8T_IS_BYTE |
| 227 | +#endif |
| 228 | + |
| 229 | +#endif |
| 230 | + |
| 231 | +#if (ULLONG_MAX / 0xFFULL > 0xFFULL) |
| 232 | +#ifndef I16T |
| 233 | +#define I16T long long |
| 234 | +#define U16C(v) (v##ULL) |
| 235 | +#endif |
| 236 | + |
| 237 | +#if (ULLONG_MAX / 0xFFFFULL > 0xFFFFULL) |
| 238 | +#ifndef I32T |
| 239 | +#define I32T long long |
| 240 | +#define U32C(v) (v##ULL) |
| 241 | +#endif |
| 242 | + |
| 243 | +#if (ULLONG_MAX / 0xFFFFFFFFULL > 0xFFFFFFFFULL) |
| 244 | +#ifndef I64T |
| 245 | +#define I64T long long |
| 246 | +#define U64C(v) (v##ULL) |
| 247 | +#endif |
| 248 | + |
| 249 | +#endif |
| 250 | +#endif |
| 251 | +#endif |
| 252 | +#endif |
| 253 | + |
| 254 | +#endif |
| 255 | + |
| 256 | +/* --- check __int64 --- */ |
| 257 | + |
| 258 | +#ifdef _UI64_MAX |
| 259 | + |
| 260 | +#if (_UI64_MAX / 0xFFFFFFFFui64 > 0xFFFFFFFFui64) |
| 261 | +#ifndef I64T |
| 262 | +#define I64T __int64 |
| 263 | +#define U64C(v) (v##ui64) |
| 264 | +#endif |
| 265 | + |
| 266 | +#endif |
| 267 | + |
| 268 | +#endif |
| 269 | + |
| 270 | +/* ------------------------------------------------------------------------- */ |
| 271 | + |
| 272 | +#endif |
0 commit comments