Fri, 16 Jan 2015 04:50:19 +0100
Replace accessor implementation with direct member state manipulation, by
request https://trac.torproject.org/projects/tor/ticket/9701#comment:32
michael@0 | 1 | /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ |
michael@0 | 2 | /* This Source Code Form is subject to the terms of the Mozilla Public |
michael@0 | 3 | * License, v. 2.0. If a copy of the MPL was not distributed with this |
michael@0 | 4 | * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ |
michael@0 | 5 | |
michael@0 | 6 | /* |
michael@0 | 7 | * This file is used by not only Linux but also other glibc systems |
michael@0 | 8 | * such as GNU/Hurd and GNU/k*BSD. |
michael@0 | 9 | */ |
michael@0 | 10 | |
michael@0 | 11 | #ifndef nspr_cpucfg___ |
michael@0 | 12 | #define nspr_cpucfg___ |
michael@0 | 13 | |
michael@0 | 14 | #ifndef XP_UNIX |
michael@0 | 15 | #define XP_UNIX |
michael@0 | 16 | #endif |
michael@0 | 17 | |
michael@0 | 18 | #if !defined(LINUX) && defined(__linux__) |
michael@0 | 19 | #define LINUX |
michael@0 | 20 | #endif |
michael@0 | 21 | |
michael@0 | 22 | #ifdef __FreeBSD_kernel__ |
michael@0 | 23 | #define PR_AF_INET6 28 /* same as AF_INET6 */ |
michael@0 | 24 | #elif defined(__GNU__) |
michael@0 | 25 | #define PR_AF_INET6 26 /* same as AF_INET6 */ |
michael@0 | 26 | #else |
michael@0 | 27 | #define PR_AF_INET6 10 /* same as AF_INET6 */ |
michael@0 | 28 | #endif |
michael@0 | 29 | |
michael@0 | 30 | #ifdef __powerpc64__ |
michael@0 | 31 | |
michael@0 | 32 | #ifdef __LITTLE_ENDIAN__ |
michael@0 | 33 | #define IS_LITTLE_ENDIAN 1 |
michael@0 | 34 | #undef IS_BIG_ENDIAN |
michael@0 | 35 | #else |
michael@0 | 36 | #undef IS_LITTLE_ENDIAN |
michael@0 | 37 | #define IS_BIG_ENDIAN 1 |
michael@0 | 38 | #endif |
michael@0 | 39 | #define IS_64 |
michael@0 | 40 | |
michael@0 | 41 | #define PR_BYTES_PER_BYTE 1 |
michael@0 | 42 | #define PR_BYTES_PER_SHORT 2 |
michael@0 | 43 | #define PR_BYTES_PER_INT 4 |
michael@0 | 44 | #define PR_BYTES_PER_INT64 8 |
michael@0 | 45 | #define PR_BYTES_PER_LONG 8 |
michael@0 | 46 | #define PR_BYTES_PER_FLOAT 4 |
michael@0 | 47 | #define PR_BYTES_PER_DOUBLE 8 |
michael@0 | 48 | #define PR_BYTES_PER_WORD 8 |
michael@0 | 49 | #define PR_BYTES_PER_DWORD 8 |
michael@0 | 50 | |
michael@0 | 51 | #define PR_BITS_PER_BYTE 8 |
michael@0 | 52 | #define PR_BITS_PER_SHORT 16 |
michael@0 | 53 | #define PR_BITS_PER_INT 32 |
michael@0 | 54 | #define PR_BITS_PER_INT64 64 |
michael@0 | 55 | #define PR_BITS_PER_LONG 64 |
michael@0 | 56 | #define PR_BITS_PER_FLOAT 32 |
michael@0 | 57 | #define PR_BITS_PER_DOUBLE 64 |
michael@0 | 58 | #define PR_BITS_PER_WORD 64 |
michael@0 | 59 | |
michael@0 | 60 | #define PR_BITS_PER_BYTE_LOG2 3 |
michael@0 | 61 | #define PR_BITS_PER_SHORT_LOG2 4 |
michael@0 | 62 | #define PR_BITS_PER_INT_LOG2 5 |
michael@0 | 63 | #define PR_BITS_PER_INT64_LOG2 6 |
michael@0 | 64 | #define PR_BITS_PER_LONG_LOG2 6 |
michael@0 | 65 | #define PR_BITS_PER_FLOAT_LOG2 5 |
michael@0 | 66 | #define PR_BITS_PER_DOUBLE_LOG2 6 |
michael@0 | 67 | #define PR_BITS_PER_WORD_LOG2 6 |
michael@0 | 68 | |
michael@0 | 69 | #define PR_ALIGN_OF_SHORT 2 |
michael@0 | 70 | #define PR_ALIGN_OF_INT 4 |
michael@0 | 71 | #define PR_ALIGN_OF_LONG 8 |
michael@0 | 72 | #define PR_ALIGN_OF_INT64 8 |
michael@0 | 73 | #define PR_ALIGN_OF_FLOAT 4 |
michael@0 | 74 | #define PR_ALIGN_OF_DOUBLE 8 |
michael@0 | 75 | #define PR_ALIGN_OF_POINTER 8 |
michael@0 | 76 | #define PR_ALIGN_OF_WORD 8 |
michael@0 | 77 | |
michael@0 | 78 | #define PR_BYTES_PER_WORD_LOG2 3 |
michael@0 | 79 | #define PR_BYTES_PER_DWORD_LOG2 3 |
michael@0 | 80 | |
michael@0 | 81 | #elif defined(__powerpc__) |
michael@0 | 82 | |
michael@0 | 83 | #ifdef __LITTLE_ENDIAN__ |
michael@0 | 84 | #define IS_LITTLE_ENDIAN 1 |
michael@0 | 85 | #undef IS_BIG_ENDIAN |
michael@0 | 86 | #else |
michael@0 | 87 | #undef IS_LITTLE_ENDIAN |
michael@0 | 88 | #define IS_BIG_ENDIAN 1 |
michael@0 | 89 | #endif |
michael@0 | 90 | |
michael@0 | 91 | #define PR_BYTES_PER_BYTE 1 |
michael@0 | 92 | #define PR_BYTES_PER_SHORT 2 |
michael@0 | 93 | #define PR_BYTES_PER_INT 4 |
michael@0 | 94 | #define PR_BYTES_PER_INT64 8 |
michael@0 | 95 | #define PR_BYTES_PER_LONG 4 |
michael@0 | 96 | #define PR_BYTES_PER_FLOAT 4 |
michael@0 | 97 | #define PR_BYTES_PER_DOUBLE 8 |
michael@0 | 98 | #define PR_BYTES_PER_WORD 4 |
michael@0 | 99 | #define PR_BYTES_PER_DWORD 8 |
michael@0 | 100 | |
michael@0 | 101 | #define PR_BITS_PER_BYTE 8 |
michael@0 | 102 | #define PR_BITS_PER_SHORT 16 |
michael@0 | 103 | #define PR_BITS_PER_INT 32 |
michael@0 | 104 | #define PR_BITS_PER_INT64 64 |
michael@0 | 105 | #define PR_BITS_PER_LONG 32 |
michael@0 | 106 | #define PR_BITS_PER_FLOAT 32 |
michael@0 | 107 | #define PR_BITS_PER_DOUBLE 64 |
michael@0 | 108 | #define PR_BITS_PER_WORD 32 |
michael@0 | 109 | |
michael@0 | 110 | #define PR_BITS_PER_BYTE_LOG2 3 |
michael@0 | 111 | #define PR_BITS_PER_SHORT_LOG2 4 |
michael@0 | 112 | #define PR_BITS_PER_INT_LOG2 5 |
michael@0 | 113 | #define PR_BITS_PER_INT64_LOG2 6 |
michael@0 | 114 | #define PR_BITS_PER_LONG_LOG2 5 |
michael@0 | 115 | #define PR_BITS_PER_FLOAT_LOG2 5 |
michael@0 | 116 | #define PR_BITS_PER_DOUBLE_LOG2 6 |
michael@0 | 117 | #define PR_BITS_PER_WORD_LOG2 5 |
michael@0 | 118 | |
michael@0 | 119 | #define PR_ALIGN_OF_SHORT 2 |
michael@0 | 120 | #define PR_ALIGN_OF_INT 4 |
michael@0 | 121 | #define PR_ALIGN_OF_LONG 4 |
michael@0 | 122 | #define PR_ALIGN_OF_INT64 8 |
michael@0 | 123 | #define PR_ALIGN_OF_FLOAT 4 |
michael@0 | 124 | #define PR_ALIGN_OF_DOUBLE 8 |
michael@0 | 125 | #define PR_ALIGN_OF_POINTER 4 |
michael@0 | 126 | #define PR_ALIGN_OF_WORD 4 |
michael@0 | 127 | |
michael@0 | 128 | #define PR_BYTES_PER_WORD_LOG2 2 |
michael@0 | 129 | #define PR_BYTES_PER_DWORD_LOG2 3 |
michael@0 | 130 | |
michael@0 | 131 | #elif defined(__alpha) |
michael@0 | 132 | |
michael@0 | 133 | #define IS_LITTLE_ENDIAN 1 |
michael@0 | 134 | #undef IS_BIG_ENDIAN |
michael@0 | 135 | #define IS_64 |
michael@0 | 136 | |
michael@0 | 137 | #define PR_BYTES_PER_BYTE 1 |
michael@0 | 138 | #define PR_BYTES_PER_SHORT 2 |
michael@0 | 139 | #define PR_BYTES_PER_INT 4 |
michael@0 | 140 | #define PR_BYTES_PER_INT64 8 |
michael@0 | 141 | #define PR_BYTES_PER_LONG 8 |
michael@0 | 142 | #define PR_BYTES_PER_FLOAT 4 |
michael@0 | 143 | #define PR_BYTES_PER_DOUBLE 8 |
michael@0 | 144 | #define PR_BYTES_PER_WORD 8 |
michael@0 | 145 | #define PR_BYTES_PER_DWORD 8 |
michael@0 | 146 | |
michael@0 | 147 | #define PR_BITS_PER_BYTE 8 |
michael@0 | 148 | #define PR_BITS_PER_SHORT 16 |
michael@0 | 149 | #define PR_BITS_PER_INT 32 |
michael@0 | 150 | #define PR_BITS_PER_INT64 64 |
michael@0 | 151 | #define PR_BITS_PER_LONG 64 |
michael@0 | 152 | #define PR_BITS_PER_FLOAT 32 |
michael@0 | 153 | #define PR_BITS_PER_DOUBLE 64 |
michael@0 | 154 | #define PR_BITS_PER_WORD 64 |
michael@0 | 155 | |
michael@0 | 156 | #define PR_BITS_PER_BYTE_LOG2 3 |
michael@0 | 157 | #define PR_BITS_PER_SHORT_LOG2 4 |
michael@0 | 158 | #define PR_BITS_PER_INT_LOG2 5 |
michael@0 | 159 | #define PR_BITS_PER_INT64_LOG2 6 |
michael@0 | 160 | #define PR_BITS_PER_LONG_LOG2 6 |
michael@0 | 161 | #define PR_BITS_PER_FLOAT_LOG2 5 |
michael@0 | 162 | #define PR_BITS_PER_DOUBLE_LOG2 6 |
michael@0 | 163 | #define PR_BITS_PER_WORD_LOG2 6 |
michael@0 | 164 | |
michael@0 | 165 | #define PR_ALIGN_OF_SHORT 2 |
michael@0 | 166 | #define PR_ALIGN_OF_INT 4 |
michael@0 | 167 | #define PR_ALIGN_OF_LONG 8 |
michael@0 | 168 | #define PR_ALIGN_OF_INT64 8 |
michael@0 | 169 | #define PR_ALIGN_OF_FLOAT 4 |
michael@0 | 170 | #define PR_ALIGN_OF_DOUBLE 8 |
michael@0 | 171 | #define PR_ALIGN_OF_POINTER 8 |
michael@0 | 172 | #define PR_ALIGN_OF_WORD 8 |
michael@0 | 173 | |
michael@0 | 174 | #define PR_BYTES_PER_WORD_LOG2 3 |
michael@0 | 175 | #define PR_BYTES_PER_DWORD_LOG2 3 |
michael@0 | 176 | |
michael@0 | 177 | #elif defined(__ia64__) |
michael@0 | 178 | |
michael@0 | 179 | #define IS_LITTLE_ENDIAN 1 |
michael@0 | 180 | #undef IS_BIG_ENDIAN |
michael@0 | 181 | #define IS_64 |
michael@0 | 182 | |
michael@0 | 183 | #define PR_BYTES_PER_BYTE 1 |
michael@0 | 184 | #define PR_BYTES_PER_SHORT 2 |
michael@0 | 185 | #define PR_BYTES_PER_INT 4 |
michael@0 | 186 | #define PR_BYTES_PER_INT64 8 |
michael@0 | 187 | #define PR_BYTES_PER_LONG 8 |
michael@0 | 188 | #define PR_BYTES_PER_FLOAT 4 |
michael@0 | 189 | #define PR_BYTES_PER_DOUBLE 8 |
michael@0 | 190 | #define PR_BYTES_PER_WORD 8 |
michael@0 | 191 | #define PR_BYTES_PER_DWORD 8 |
michael@0 | 192 | |
michael@0 | 193 | #define PR_BITS_PER_BYTE 8 |
michael@0 | 194 | #define PR_BITS_PER_SHORT 16 |
michael@0 | 195 | #define PR_BITS_PER_INT 32 |
michael@0 | 196 | #define PR_BITS_PER_INT64 64 |
michael@0 | 197 | #define PR_BITS_PER_LONG 64 |
michael@0 | 198 | #define PR_BITS_PER_FLOAT 32 |
michael@0 | 199 | #define PR_BITS_PER_DOUBLE 64 |
michael@0 | 200 | #define PR_BITS_PER_WORD 64 |
michael@0 | 201 | |
michael@0 | 202 | #define PR_BITS_PER_BYTE_LOG2 3 |
michael@0 | 203 | #define PR_BITS_PER_SHORT_LOG2 4 |
michael@0 | 204 | #define PR_BITS_PER_INT_LOG2 5 |
michael@0 | 205 | #define PR_BITS_PER_INT64_LOG2 6 |
michael@0 | 206 | #define PR_BITS_PER_LONG_LOG2 6 |
michael@0 | 207 | #define PR_BITS_PER_FLOAT_LOG2 5 |
michael@0 | 208 | #define PR_BITS_PER_DOUBLE_LOG2 6 |
michael@0 | 209 | #define PR_BITS_PER_WORD_LOG2 6 |
michael@0 | 210 | |
michael@0 | 211 | #define PR_ALIGN_OF_SHORT 2 |
michael@0 | 212 | #define PR_ALIGN_OF_INT 4 |
michael@0 | 213 | #define PR_ALIGN_OF_LONG 8 |
michael@0 | 214 | #define PR_ALIGN_OF_INT64 8 |
michael@0 | 215 | #define PR_ALIGN_OF_FLOAT 4 |
michael@0 | 216 | #define PR_ALIGN_OF_DOUBLE 8 |
michael@0 | 217 | #define PR_ALIGN_OF_POINTER 8 |
michael@0 | 218 | #define PR_ALIGN_OF_WORD 8 |
michael@0 | 219 | |
michael@0 | 220 | #define PR_BYTES_PER_WORD_LOG2 3 |
michael@0 | 221 | #define PR_BYTES_PER_DWORD_LOG2 3 |
michael@0 | 222 | |
michael@0 | 223 | #elif defined(__x86_64__) |
michael@0 | 224 | |
michael@0 | 225 | #ifdef __ILP32__ |
michael@0 | 226 | |
michael@0 | 227 | #define IS_LITTLE_ENDIAN 1 |
michael@0 | 228 | #undef IS_BIG_ENDIAN |
michael@0 | 229 | |
michael@0 | 230 | #define PR_BYTES_PER_BYTE 1 |
michael@0 | 231 | #define PR_BYTES_PER_SHORT 2 |
michael@0 | 232 | #define PR_BYTES_PER_INT 4 |
michael@0 | 233 | #define PR_BYTES_PER_INT64 8 |
michael@0 | 234 | #define PR_BYTES_PER_LONG 4 |
michael@0 | 235 | #define PR_BYTES_PER_FLOAT 4 |
michael@0 | 236 | #define PR_BYTES_PER_DOUBLE 8 |
michael@0 | 237 | #define PR_BYTES_PER_WORD 4 |
michael@0 | 238 | #define PR_BYTES_PER_DWORD 8 |
michael@0 | 239 | |
michael@0 | 240 | #define PR_BITS_PER_BYTE 8 |
michael@0 | 241 | #define PR_BITS_PER_SHORT 16 |
michael@0 | 242 | #define PR_BITS_PER_INT 32 |
michael@0 | 243 | #define PR_BITS_PER_INT64 64 |
michael@0 | 244 | #define PR_BITS_PER_LONG 32 |
michael@0 | 245 | #define PR_BITS_PER_FLOAT 32 |
michael@0 | 246 | #define PR_BITS_PER_DOUBLE 64 |
michael@0 | 247 | #define PR_BITS_PER_WORD 32 |
michael@0 | 248 | |
michael@0 | 249 | #define PR_BITS_PER_BYTE_LOG2 3 |
michael@0 | 250 | #define PR_BITS_PER_SHORT_LOG2 4 |
michael@0 | 251 | #define PR_BITS_PER_INT_LOG2 5 |
michael@0 | 252 | #define PR_BITS_PER_INT64_LOG2 6 |
michael@0 | 253 | #define PR_BITS_PER_LONG_LOG2 5 |
michael@0 | 254 | #define PR_BITS_PER_FLOAT_LOG2 5 |
michael@0 | 255 | #define PR_BITS_PER_DOUBLE_LOG2 6 |
michael@0 | 256 | #define PR_BITS_PER_WORD_LOG2 5 |
michael@0 | 257 | |
michael@0 | 258 | #define PR_ALIGN_OF_SHORT 2 |
michael@0 | 259 | #define PR_ALIGN_OF_INT 4 |
michael@0 | 260 | #define PR_ALIGN_OF_LONG 4 |
michael@0 | 261 | #define PR_ALIGN_OF_INT64 8 |
michael@0 | 262 | #define PR_ALIGN_OF_FLOAT 4 |
michael@0 | 263 | #define PR_ALIGN_OF_DOUBLE 8 |
michael@0 | 264 | #define PR_ALIGN_OF_POINTER 4 |
michael@0 | 265 | #define PR_ALIGN_OF_WORD 4 |
michael@0 | 266 | |
michael@0 | 267 | #define PR_BYTES_PER_WORD_LOG2 2 |
michael@0 | 268 | #define PR_BYTES_PER_DWORD_LOG2 3 |
michael@0 | 269 | |
michael@0 | 270 | #else |
michael@0 | 271 | |
michael@0 | 272 | #define IS_LITTLE_ENDIAN 1 |
michael@0 | 273 | #undef IS_BIG_ENDIAN |
michael@0 | 274 | #define IS_64 |
michael@0 | 275 | |
michael@0 | 276 | #define PR_BYTES_PER_BYTE 1 |
michael@0 | 277 | #define PR_BYTES_PER_SHORT 2 |
michael@0 | 278 | #define PR_BYTES_PER_INT 4 |
michael@0 | 279 | #define PR_BYTES_PER_INT64 8 |
michael@0 | 280 | #define PR_BYTES_PER_LONG 8 |
michael@0 | 281 | #define PR_BYTES_PER_FLOAT 4 |
michael@0 | 282 | #define PR_BYTES_PER_DOUBLE 8 |
michael@0 | 283 | #define PR_BYTES_PER_WORD 8 |
michael@0 | 284 | #define PR_BYTES_PER_DWORD 8 |
michael@0 | 285 | |
michael@0 | 286 | #define PR_BITS_PER_BYTE 8 |
michael@0 | 287 | #define PR_BITS_PER_SHORT 16 |
michael@0 | 288 | #define PR_BITS_PER_INT 32 |
michael@0 | 289 | #define PR_BITS_PER_INT64 64 |
michael@0 | 290 | #define PR_BITS_PER_LONG 64 |
michael@0 | 291 | #define PR_BITS_PER_FLOAT 32 |
michael@0 | 292 | #define PR_BITS_PER_DOUBLE 64 |
michael@0 | 293 | #define PR_BITS_PER_WORD 64 |
michael@0 | 294 | |
michael@0 | 295 | #define PR_BITS_PER_BYTE_LOG2 3 |
michael@0 | 296 | #define PR_BITS_PER_SHORT_LOG2 4 |
michael@0 | 297 | #define PR_BITS_PER_INT_LOG2 5 |
michael@0 | 298 | #define PR_BITS_PER_INT64_LOG2 6 |
michael@0 | 299 | #define PR_BITS_PER_LONG_LOG2 6 |
michael@0 | 300 | #define PR_BITS_PER_FLOAT_LOG2 5 |
michael@0 | 301 | #define PR_BITS_PER_DOUBLE_LOG2 6 |
michael@0 | 302 | #define PR_BITS_PER_WORD_LOG2 6 |
michael@0 | 303 | |
michael@0 | 304 | #define PR_ALIGN_OF_SHORT 2 |
michael@0 | 305 | #define PR_ALIGN_OF_INT 4 |
michael@0 | 306 | #define PR_ALIGN_OF_LONG 8 |
michael@0 | 307 | #define PR_ALIGN_OF_INT64 8 |
michael@0 | 308 | #define PR_ALIGN_OF_FLOAT 4 |
michael@0 | 309 | #define PR_ALIGN_OF_DOUBLE 8 |
michael@0 | 310 | #define PR_ALIGN_OF_POINTER 8 |
michael@0 | 311 | #define PR_ALIGN_OF_WORD 8 |
michael@0 | 312 | |
michael@0 | 313 | #define PR_BYTES_PER_WORD_LOG2 3 |
michael@0 | 314 | #define PR_BYTES_PER_DWORD_LOG2 3 |
michael@0 | 315 | |
michael@0 | 316 | #endif |
michael@0 | 317 | |
michael@0 | 318 | #elif defined(__mc68000__) |
michael@0 | 319 | |
michael@0 | 320 | #undef IS_LITTLE_ENDIAN |
michael@0 | 321 | #define IS_BIG_ENDIAN 1 |
michael@0 | 322 | |
michael@0 | 323 | #define PR_BYTES_PER_BYTE 1 |
michael@0 | 324 | #define PR_BYTES_PER_SHORT 2 |
michael@0 | 325 | #define PR_BYTES_PER_INT 4 |
michael@0 | 326 | #define PR_BYTES_PER_INT64 8 |
michael@0 | 327 | #define PR_BYTES_PER_LONG 4 |
michael@0 | 328 | #define PR_BYTES_PER_FLOAT 4 |
michael@0 | 329 | #define PR_BYTES_PER_DOUBLE 8 |
michael@0 | 330 | #define PR_BYTES_PER_WORD 4 |
michael@0 | 331 | #define PR_BYTES_PER_DWORD 8 |
michael@0 | 332 | |
michael@0 | 333 | #define PR_BITS_PER_BYTE 8 |
michael@0 | 334 | #define PR_BITS_PER_SHORT 16 |
michael@0 | 335 | #define PR_BITS_PER_INT 32 |
michael@0 | 336 | #define PR_BITS_PER_INT64 64 |
michael@0 | 337 | #define PR_BITS_PER_LONG 32 |
michael@0 | 338 | #define PR_BITS_PER_FLOAT 32 |
michael@0 | 339 | #define PR_BITS_PER_DOUBLE 64 |
michael@0 | 340 | #define PR_BITS_PER_WORD 32 |
michael@0 | 341 | |
michael@0 | 342 | #define PR_BITS_PER_BYTE_LOG2 3 |
michael@0 | 343 | #define PR_BITS_PER_SHORT_LOG2 4 |
michael@0 | 344 | #define PR_BITS_PER_INT_LOG2 5 |
michael@0 | 345 | #define PR_BITS_PER_INT64_LOG2 6 |
michael@0 | 346 | #define PR_BITS_PER_LONG_LOG2 5 |
michael@0 | 347 | #define PR_BITS_PER_FLOAT_LOG2 5 |
michael@0 | 348 | #define PR_BITS_PER_DOUBLE_LOG2 6 |
michael@0 | 349 | #define PR_BITS_PER_WORD_LOG2 5 |
michael@0 | 350 | |
michael@0 | 351 | #define PR_ALIGN_OF_SHORT 2 |
michael@0 | 352 | #define PR_ALIGN_OF_INT 2 |
michael@0 | 353 | #define PR_ALIGN_OF_LONG 2 |
michael@0 | 354 | #define PR_ALIGN_OF_INT64 2 |
michael@0 | 355 | #define PR_ALIGN_OF_FLOAT 2 |
michael@0 | 356 | #define PR_ALIGN_OF_DOUBLE 2 |
michael@0 | 357 | #define PR_ALIGN_OF_POINTER 2 |
michael@0 | 358 | #define PR_ALIGN_OF_WORD 2 |
michael@0 | 359 | |
michael@0 | 360 | #define PR_BYTES_PER_WORD_LOG2 2 |
michael@0 | 361 | #define PR_BYTES_PER_DWORD_LOG2 3 |
michael@0 | 362 | |
michael@0 | 363 | #elif defined(__sparc__) && defined (__arch64__) |
michael@0 | 364 | |
michael@0 | 365 | #undef IS_LITTLE_ENDIAN |
michael@0 | 366 | #define IS_BIG_ENDIAN 1 |
michael@0 | 367 | #define IS_64 |
michael@0 | 368 | |
michael@0 | 369 | #define PR_BYTES_PER_BYTE 1 |
michael@0 | 370 | #define PR_BYTES_PER_SHORT 2 |
michael@0 | 371 | #define PR_BYTES_PER_INT 4 |
michael@0 | 372 | #define PR_BYTES_PER_INT64 8 |
michael@0 | 373 | #define PR_BYTES_PER_LONG 8 |
michael@0 | 374 | #define PR_BYTES_PER_FLOAT 4 |
michael@0 | 375 | #define PR_BYTES_PER_DOUBLE 8 |
michael@0 | 376 | #define PR_BYTES_PER_WORD 8 |
michael@0 | 377 | #define PR_BYTES_PER_DWORD 8 |
michael@0 | 378 | |
michael@0 | 379 | #define PR_BITS_PER_BYTE 8 |
michael@0 | 380 | #define PR_BITS_PER_SHORT 16 |
michael@0 | 381 | #define PR_BITS_PER_INT 32 |
michael@0 | 382 | #define PR_BITS_PER_INT64 64 |
michael@0 | 383 | #define PR_BITS_PER_LONG 64 |
michael@0 | 384 | #define PR_BITS_PER_FLOAT 32 |
michael@0 | 385 | #define PR_BITS_PER_DOUBLE 64 |
michael@0 | 386 | #define PR_BITS_PER_WORD 64 |
michael@0 | 387 | |
michael@0 | 388 | #define PR_BITS_PER_BYTE_LOG2 3 |
michael@0 | 389 | #define PR_BITS_PER_SHORT_LOG2 4 |
michael@0 | 390 | #define PR_BITS_PER_INT_LOG2 5 |
michael@0 | 391 | #define PR_BITS_PER_INT64_LOG2 6 |
michael@0 | 392 | #define PR_BITS_PER_LONG_LOG2 6 |
michael@0 | 393 | #define PR_BITS_PER_FLOAT_LOG2 5 |
michael@0 | 394 | #define PR_BITS_PER_DOUBLE_LOG2 6 |
michael@0 | 395 | #define PR_BITS_PER_WORD_LOG2 6 |
michael@0 | 396 | |
michael@0 | 397 | #define PR_ALIGN_OF_SHORT 2 |
michael@0 | 398 | #define PR_ALIGN_OF_INT 4 |
michael@0 | 399 | #define PR_ALIGN_OF_INT64 8 |
michael@0 | 400 | #define PR_ALIGN_OF_LONG 8 |
michael@0 | 401 | #define PR_ALIGN_OF_FLOAT 4 |
michael@0 | 402 | #define PR_ALIGN_OF_DOUBLE 8 |
michael@0 | 403 | #define PR_ALIGN_OF_POINTER 8 |
michael@0 | 404 | #define PR_ALIGN_OF_WORD 8 |
michael@0 | 405 | |
michael@0 | 406 | #define PR_BYTES_PER_WORD_LOG2 3 |
michael@0 | 407 | #define PR_BYTES_PER_DWORD_LOG2 3 |
michael@0 | 408 | |
michael@0 | 409 | #elif defined(__sparc__) |
michael@0 | 410 | |
michael@0 | 411 | #undef IS_LITTLE_ENDIAN |
michael@0 | 412 | #define IS_BIG_ENDIAN 1 |
michael@0 | 413 | |
michael@0 | 414 | #define PR_BYTES_PER_BYTE 1 |
michael@0 | 415 | #define PR_BYTES_PER_SHORT 2 |
michael@0 | 416 | #define PR_BYTES_PER_INT 4 |
michael@0 | 417 | #define PR_BYTES_PER_INT64 8 |
michael@0 | 418 | #define PR_BYTES_PER_LONG 4 |
michael@0 | 419 | #define PR_BYTES_PER_FLOAT 4 |
michael@0 | 420 | #define PR_BYTES_PER_DOUBLE 8 |
michael@0 | 421 | #define PR_BYTES_PER_WORD 4 |
michael@0 | 422 | #define PR_BYTES_PER_DWORD 8 |
michael@0 | 423 | |
michael@0 | 424 | #define PR_BITS_PER_BYTE 8 |
michael@0 | 425 | #define PR_BITS_PER_SHORT 16 |
michael@0 | 426 | #define PR_BITS_PER_INT 32 |
michael@0 | 427 | #define PR_BITS_PER_INT64 64 |
michael@0 | 428 | #define PR_BITS_PER_LONG 32 |
michael@0 | 429 | #define PR_BITS_PER_FLOAT 32 |
michael@0 | 430 | #define PR_BITS_PER_DOUBLE 64 |
michael@0 | 431 | #define PR_BITS_PER_WORD 32 |
michael@0 | 432 | |
michael@0 | 433 | #define PR_BITS_PER_BYTE_LOG2 3 |
michael@0 | 434 | #define PR_BITS_PER_SHORT_LOG2 4 |
michael@0 | 435 | #define PR_BITS_PER_INT_LOG2 5 |
michael@0 | 436 | #define PR_BITS_PER_INT64_LOG2 6 |
michael@0 | 437 | #define PR_BITS_PER_LONG_LOG2 5 |
michael@0 | 438 | #define PR_BITS_PER_FLOAT_LOG2 5 |
michael@0 | 439 | #define PR_BITS_PER_DOUBLE_LOG2 6 |
michael@0 | 440 | #define PR_BITS_PER_WORD_LOG2 5 |
michael@0 | 441 | |
michael@0 | 442 | #define PR_ALIGN_OF_SHORT 2 |
michael@0 | 443 | #define PR_ALIGN_OF_INT 4 |
michael@0 | 444 | #define PR_ALIGN_OF_LONG 4 |
michael@0 | 445 | #define PR_ALIGN_OF_INT64 8 |
michael@0 | 446 | #define PR_ALIGN_OF_FLOAT 4 |
michael@0 | 447 | #define PR_ALIGN_OF_DOUBLE 8 |
michael@0 | 448 | #define PR_ALIGN_OF_POINTER 4 |
michael@0 | 449 | #define PR_ALIGN_OF_WORD 4 |
michael@0 | 450 | |
michael@0 | 451 | #define PR_BYTES_PER_WORD_LOG2 2 |
michael@0 | 452 | #define PR_BYTES_PER_DWORD_LOG2 3 |
michael@0 | 453 | |
michael@0 | 454 | #elif defined(__i386__) |
michael@0 | 455 | |
michael@0 | 456 | #define IS_LITTLE_ENDIAN 1 |
michael@0 | 457 | #undef IS_BIG_ENDIAN |
michael@0 | 458 | |
michael@0 | 459 | #define PR_BYTES_PER_BYTE 1 |
michael@0 | 460 | #define PR_BYTES_PER_SHORT 2 |
michael@0 | 461 | #define PR_BYTES_PER_INT 4 |
michael@0 | 462 | #define PR_BYTES_PER_INT64 8 |
michael@0 | 463 | #define PR_BYTES_PER_LONG 4 |
michael@0 | 464 | #define PR_BYTES_PER_FLOAT 4 |
michael@0 | 465 | #define PR_BYTES_PER_DOUBLE 8 |
michael@0 | 466 | #define PR_BYTES_PER_WORD 4 |
michael@0 | 467 | #define PR_BYTES_PER_DWORD 8 |
michael@0 | 468 | |
michael@0 | 469 | #define PR_BITS_PER_BYTE 8 |
michael@0 | 470 | #define PR_BITS_PER_SHORT 16 |
michael@0 | 471 | #define PR_BITS_PER_INT 32 |
michael@0 | 472 | #define PR_BITS_PER_INT64 64 |
michael@0 | 473 | #define PR_BITS_PER_LONG 32 |
michael@0 | 474 | #define PR_BITS_PER_FLOAT 32 |
michael@0 | 475 | #define PR_BITS_PER_DOUBLE 64 |
michael@0 | 476 | #define PR_BITS_PER_WORD 32 |
michael@0 | 477 | |
michael@0 | 478 | #define PR_BITS_PER_BYTE_LOG2 3 |
michael@0 | 479 | #define PR_BITS_PER_SHORT_LOG2 4 |
michael@0 | 480 | #define PR_BITS_PER_INT_LOG2 5 |
michael@0 | 481 | #define PR_BITS_PER_INT64_LOG2 6 |
michael@0 | 482 | #define PR_BITS_PER_LONG_LOG2 5 |
michael@0 | 483 | #define PR_BITS_PER_FLOAT_LOG2 5 |
michael@0 | 484 | #define PR_BITS_PER_DOUBLE_LOG2 6 |
michael@0 | 485 | #define PR_BITS_PER_WORD_LOG2 5 |
michael@0 | 486 | |
michael@0 | 487 | #define PR_ALIGN_OF_SHORT 2 |
michael@0 | 488 | #define PR_ALIGN_OF_INT 4 |
michael@0 | 489 | #define PR_ALIGN_OF_LONG 4 |
michael@0 | 490 | #define PR_ALIGN_OF_INT64 4 |
michael@0 | 491 | #define PR_ALIGN_OF_FLOAT 4 |
michael@0 | 492 | #define PR_ALIGN_OF_DOUBLE 4 |
michael@0 | 493 | #define PR_ALIGN_OF_POINTER 4 |
michael@0 | 494 | #define PR_ALIGN_OF_WORD 4 |
michael@0 | 495 | |
michael@0 | 496 | #define PR_BYTES_PER_WORD_LOG2 2 |
michael@0 | 497 | #define PR_BYTES_PER_DWORD_LOG2 3 |
michael@0 | 498 | |
michael@0 | 499 | #elif defined(__mips__) |
michael@0 | 500 | |
michael@0 | 501 | #ifdef __MIPSEB__ |
michael@0 | 502 | #define IS_BIG_ENDIAN 1 |
michael@0 | 503 | #undef IS_LITTLE_ENDIAN |
michael@0 | 504 | #elif defined(__MIPSEL__) |
michael@0 | 505 | #define IS_LITTLE_ENDIAN 1 |
michael@0 | 506 | #undef IS_BIG_ENDIAN |
michael@0 | 507 | #else |
michael@0 | 508 | #error "Unknown MIPS endianness." |
michael@0 | 509 | #endif |
michael@0 | 510 | |
michael@0 | 511 | #define PR_BYTES_PER_BYTE 1 |
michael@0 | 512 | #define PR_BYTES_PER_SHORT 2 |
michael@0 | 513 | #define PR_BYTES_PER_INT 4 |
michael@0 | 514 | #define PR_BYTES_PER_INT64 8 |
michael@0 | 515 | #define PR_BYTES_PER_LONG 4 |
michael@0 | 516 | #define PR_BYTES_PER_FLOAT 4 |
michael@0 | 517 | #define PR_BYTES_PER_DOUBLE 8 |
michael@0 | 518 | #define PR_BYTES_PER_WORD 4 |
michael@0 | 519 | #define PR_BYTES_PER_DWORD 8 |
michael@0 | 520 | |
michael@0 | 521 | #define PR_BITS_PER_BYTE 8 |
michael@0 | 522 | #define PR_BITS_PER_SHORT 16 |
michael@0 | 523 | #define PR_BITS_PER_INT 32 |
michael@0 | 524 | #define PR_BITS_PER_INT64 64 |
michael@0 | 525 | #define PR_BITS_PER_LONG 32 |
michael@0 | 526 | #define PR_BITS_PER_FLOAT 32 |
michael@0 | 527 | #define PR_BITS_PER_DOUBLE 64 |
michael@0 | 528 | #define PR_BITS_PER_WORD 32 |
michael@0 | 529 | |
michael@0 | 530 | #define PR_BITS_PER_BYTE_LOG2 3 |
michael@0 | 531 | #define PR_BITS_PER_SHORT_LOG2 4 |
michael@0 | 532 | #define PR_BITS_PER_INT_LOG2 5 |
michael@0 | 533 | #define PR_BITS_PER_INT64_LOG2 6 |
michael@0 | 534 | #define PR_BITS_PER_LONG_LOG2 5 |
michael@0 | 535 | #define PR_BITS_PER_FLOAT_LOG2 5 |
michael@0 | 536 | #define PR_BITS_PER_DOUBLE_LOG2 6 |
michael@0 | 537 | #define PR_BITS_PER_WORD_LOG2 5 |
michael@0 | 538 | |
michael@0 | 539 | #define PR_ALIGN_OF_SHORT 2 |
michael@0 | 540 | #define PR_ALIGN_OF_INT 4 |
michael@0 | 541 | #define PR_ALIGN_OF_LONG 4 |
michael@0 | 542 | #define PR_ALIGN_OF_INT64 8 |
michael@0 | 543 | #define PR_ALIGN_OF_FLOAT 4 |
michael@0 | 544 | #define PR_ALIGN_OF_DOUBLE 8 |
michael@0 | 545 | #define PR_ALIGN_OF_POINTER 4 |
michael@0 | 546 | #define PR_ALIGN_OF_WORD 4 |
michael@0 | 547 | |
michael@0 | 548 | #define PR_BYTES_PER_WORD_LOG2 2 |
michael@0 | 549 | #define PR_BYTES_PER_DWORD_LOG2 3 |
michael@0 | 550 | |
michael@0 | 551 | #elif defined(__arm__) |
michael@0 | 552 | |
michael@0 | 553 | #ifdef __ARMEB__ |
michael@0 | 554 | #undef IS_LITTLE_ENDIAN |
michael@0 | 555 | #define IS_BIG_ENDIAN 1 |
michael@0 | 556 | #elif defined(__ARMEL__) |
michael@0 | 557 | #define IS_LITTLE_ENDIAN 1 |
michael@0 | 558 | #undef IS_BIG_ENDIAN |
michael@0 | 559 | #else |
michael@0 | 560 | #error "Unknown ARM endianness." |
michael@0 | 561 | #endif |
michael@0 | 562 | |
michael@0 | 563 | #define PR_BYTES_PER_BYTE 1 |
michael@0 | 564 | #define PR_BYTES_PER_SHORT 2 |
michael@0 | 565 | #define PR_BYTES_PER_INT 4 |
michael@0 | 566 | #define PR_BYTES_PER_INT64 8 |
michael@0 | 567 | #define PR_BYTES_PER_LONG 4 |
michael@0 | 568 | #define PR_BYTES_PER_FLOAT 4 |
michael@0 | 569 | #define PR_BYTES_PER_DOUBLE 8 |
michael@0 | 570 | #define PR_BYTES_PER_WORD 4 |
michael@0 | 571 | #define PR_BYTES_PER_DWORD 8 |
michael@0 | 572 | |
michael@0 | 573 | #define PR_BITS_PER_BYTE 8 |
michael@0 | 574 | #define PR_BITS_PER_SHORT 16 |
michael@0 | 575 | #define PR_BITS_PER_INT 32 |
michael@0 | 576 | #define PR_BITS_PER_INT64 64 |
michael@0 | 577 | #define PR_BITS_PER_LONG 32 |
michael@0 | 578 | #define PR_BITS_PER_FLOAT 32 |
michael@0 | 579 | #define PR_BITS_PER_DOUBLE 64 |
michael@0 | 580 | #define PR_BITS_PER_WORD 32 |
michael@0 | 581 | |
michael@0 | 582 | #define PR_BITS_PER_BYTE_LOG2 3 |
michael@0 | 583 | #define PR_BITS_PER_SHORT_LOG2 4 |
michael@0 | 584 | #define PR_BITS_PER_INT_LOG2 5 |
michael@0 | 585 | #define PR_BITS_PER_INT64_LOG2 6 |
michael@0 | 586 | #define PR_BITS_PER_LONG_LOG2 5 |
michael@0 | 587 | #define PR_BITS_PER_FLOAT_LOG2 5 |
michael@0 | 588 | #define PR_BITS_PER_DOUBLE_LOG2 6 |
michael@0 | 589 | #define PR_BITS_PER_WORD_LOG2 5 |
michael@0 | 590 | |
michael@0 | 591 | #define PR_ALIGN_OF_SHORT 2 |
michael@0 | 592 | #define PR_ALIGN_OF_INT 4 |
michael@0 | 593 | #define PR_ALIGN_OF_LONG 4 |
michael@0 | 594 | #define PR_ALIGN_OF_INT64 4 |
michael@0 | 595 | #define PR_ALIGN_OF_FLOAT 4 |
michael@0 | 596 | #define PR_ALIGN_OF_DOUBLE 4 |
michael@0 | 597 | #define PR_ALIGN_OF_POINTER 4 |
michael@0 | 598 | #define PR_ALIGN_OF_WORD 4 |
michael@0 | 599 | |
michael@0 | 600 | #define PR_BYTES_PER_WORD_LOG2 2 |
michael@0 | 601 | #define PR_BYTES_PER_DWORD_LOG2 3 |
michael@0 | 602 | |
michael@0 | 603 | #elif defined(__aarch64__) |
michael@0 | 604 | |
michael@0 | 605 | #ifdef __AARCH64EB__ |
michael@0 | 606 | #undef IS_LITTLE_ENDIAN |
michael@0 | 607 | #define IS_BIG_ENDIAN 1 |
michael@0 | 608 | #elif defined(__AARCH64EL__) |
michael@0 | 609 | #define IS_LITTLE_ENDIAN 1 |
michael@0 | 610 | #undef IS_BIG_ENDIAN |
michael@0 | 611 | #else |
michael@0 | 612 | #error "Unknown Aarch64 endianness." |
michael@0 | 613 | #endif |
michael@0 | 614 | #define IS_64 |
michael@0 | 615 | |
michael@0 | 616 | #define PR_BYTES_PER_BYTE 1 |
michael@0 | 617 | #define PR_BYTES_PER_SHORT 2 |
michael@0 | 618 | #define PR_BYTES_PER_INT 4 |
michael@0 | 619 | #define PR_BYTES_PER_INT64 8 |
michael@0 | 620 | #define PR_BYTES_PER_LONG 8 |
michael@0 | 621 | #define PR_BYTES_PER_FLOAT 4 |
michael@0 | 622 | #define PR_BYTES_PER_DOUBLE 8 |
michael@0 | 623 | #define PR_BYTES_PER_WORD 8 |
michael@0 | 624 | #define PR_BYTES_PER_DWORD 8 |
michael@0 | 625 | |
michael@0 | 626 | #define PR_BITS_PER_BYTE 8 |
michael@0 | 627 | #define PR_BITS_PER_SHORT 16 |
michael@0 | 628 | #define PR_BITS_PER_INT 32 |
michael@0 | 629 | #define PR_BITS_PER_INT64 64 |
michael@0 | 630 | #define PR_BITS_PER_LONG 64 |
michael@0 | 631 | #define PR_BITS_PER_FLOAT 32 |
michael@0 | 632 | #define PR_BITS_PER_DOUBLE 64 |
michael@0 | 633 | #define PR_BITS_PER_WORD 64 |
michael@0 | 634 | |
michael@0 | 635 | #define PR_BITS_PER_BYTE_LOG2 3 |
michael@0 | 636 | #define PR_BITS_PER_SHORT_LOG2 4 |
michael@0 | 637 | #define PR_BITS_PER_INT_LOG2 5 |
michael@0 | 638 | #define PR_BITS_PER_INT64_LOG2 6 |
michael@0 | 639 | #define PR_BITS_PER_LONG_LOG2 6 |
michael@0 | 640 | #define PR_BITS_PER_FLOAT_LOG2 5 |
michael@0 | 641 | #define PR_BITS_PER_DOUBLE_LOG2 6 |
michael@0 | 642 | #define PR_BITS_PER_WORD_LOG2 6 |
michael@0 | 643 | |
michael@0 | 644 | #define PR_ALIGN_OF_SHORT 2 |
michael@0 | 645 | #define PR_ALIGN_OF_INT 4 |
michael@0 | 646 | #define PR_ALIGN_OF_LONG 8 |
michael@0 | 647 | #define PR_ALIGN_OF_INT64 8 |
michael@0 | 648 | #define PR_ALIGN_OF_FLOAT 4 |
michael@0 | 649 | #define PR_ALIGN_OF_DOUBLE 8 |
michael@0 | 650 | #define PR_ALIGN_OF_POINTER 8 |
michael@0 | 651 | #define PR_ALIGN_OF_WORD 8 |
michael@0 | 652 | |
michael@0 | 653 | #define PR_BYTES_PER_WORD_LOG2 3 |
michael@0 | 654 | #define PR_BYTES_PER_DWORD_LOG2 3 |
michael@0 | 655 | |
michael@0 | 656 | #elif defined(__hppa__) |
michael@0 | 657 | |
michael@0 | 658 | #undef IS_LITTLE_ENDIAN |
michael@0 | 659 | #define IS_BIG_ENDIAN 1 |
michael@0 | 660 | |
michael@0 | 661 | #define PR_BYTES_PER_BYTE 1 |
michael@0 | 662 | #define PR_BYTES_PER_SHORT 2 |
michael@0 | 663 | #define PR_BYTES_PER_INT 4 |
michael@0 | 664 | #define PR_BYTES_PER_INT64 8 |
michael@0 | 665 | #define PR_BYTES_PER_LONG 4 |
michael@0 | 666 | #define PR_BYTES_PER_FLOAT 4 |
michael@0 | 667 | #define PR_BYTES_PER_DOUBLE 8 |
michael@0 | 668 | #define PR_BYTES_PER_WORD 4 |
michael@0 | 669 | #define PR_BYTES_PER_DWORD 8 |
michael@0 | 670 | |
michael@0 | 671 | #define PR_BITS_PER_BYTE 8 |
michael@0 | 672 | #define PR_BITS_PER_SHORT 16 |
michael@0 | 673 | #define PR_BITS_PER_INT 32 |
michael@0 | 674 | #define PR_BITS_PER_INT64 64 |
michael@0 | 675 | #define PR_BITS_PER_LONG 32 |
michael@0 | 676 | #define PR_BITS_PER_FLOAT 32 |
michael@0 | 677 | #define PR_BITS_PER_DOUBLE 64 |
michael@0 | 678 | #define PR_BITS_PER_WORD 32 |
michael@0 | 679 | |
michael@0 | 680 | #define PR_BITS_PER_BYTE_LOG2 3 |
michael@0 | 681 | #define PR_BITS_PER_SHORT_LOG2 4 |
michael@0 | 682 | #define PR_BITS_PER_INT_LOG2 5 |
michael@0 | 683 | #define PR_BITS_PER_INT64_LOG2 6 |
michael@0 | 684 | #define PR_BITS_PER_LONG_LOG2 5 |
michael@0 | 685 | #define PR_BITS_PER_FLOAT_LOG2 5 |
michael@0 | 686 | #define PR_BITS_PER_DOUBLE_LOG2 6 |
michael@0 | 687 | #define PR_BITS_PER_WORD_LOG2 5 |
michael@0 | 688 | |
michael@0 | 689 | #define PR_ALIGN_OF_SHORT 2 |
michael@0 | 690 | #define PR_ALIGN_OF_INT 4 |
michael@0 | 691 | #define PR_ALIGN_OF_LONG 4 |
michael@0 | 692 | #define PR_ALIGN_OF_INT64 8 |
michael@0 | 693 | #define PR_ALIGN_OF_FLOAT 4 |
michael@0 | 694 | #define PR_ALIGN_OF_DOUBLE 8 |
michael@0 | 695 | #define PR_ALIGN_OF_POINTER 4 |
michael@0 | 696 | #define PR_ALIGN_OF_WORD 4 |
michael@0 | 697 | |
michael@0 | 698 | #define PR_BYTES_PER_WORD_LOG2 2 |
michael@0 | 699 | #define PR_BYTES_PER_DWORD_LOG2 3 |
michael@0 | 700 | |
michael@0 | 701 | #elif defined(__s390x__) |
michael@0 | 702 | |
michael@0 | 703 | #define IS_BIG_ENDIAN 1 |
michael@0 | 704 | #undef IS_LITTLE_ENDIAN |
michael@0 | 705 | #define IS_64 |
michael@0 | 706 | |
michael@0 | 707 | #define PR_BYTES_PER_BYTE 1 |
michael@0 | 708 | #define PR_BYTES_PER_SHORT 2 |
michael@0 | 709 | #define PR_BYTES_PER_INT 4 |
michael@0 | 710 | #define PR_BYTES_PER_INT64 8 |
michael@0 | 711 | #define PR_BYTES_PER_LONG 8 |
michael@0 | 712 | #define PR_BYTES_PER_FLOAT 4 |
michael@0 | 713 | #define PR_BYTES_PER_DOUBLE 8 |
michael@0 | 714 | #define PR_BYTES_PER_WORD 8 |
michael@0 | 715 | #define PR_BYTES_PER_DWORD 8 |
michael@0 | 716 | |
michael@0 | 717 | #define PR_BITS_PER_BYTE 8 |
michael@0 | 718 | #define PR_BITS_PER_SHORT 16 |
michael@0 | 719 | #define PR_BITS_PER_INT 32 |
michael@0 | 720 | #define PR_BITS_PER_INT64 64 |
michael@0 | 721 | #define PR_BITS_PER_LONG 64 |
michael@0 | 722 | #define PR_BITS_PER_FLOAT 32 |
michael@0 | 723 | #define PR_BITS_PER_DOUBLE 64 |
michael@0 | 724 | #define PR_BITS_PER_WORD 64 |
michael@0 | 725 | |
michael@0 | 726 | #define PR_BITS_PER_BYTE_LOG2 3 |
michael@0 | 727 | #define PR_BITS_PER_SHORT_LOG2 4 |
michael@0 | 728 | #define PR_BITS_PER_INT_LOG2 5 |
michael@0 | 729 | #define PR_BITS_PER_INT64_LOG2 6 |
michael@0 | 730 | #define PR_BITS_PER_LONG_LOG2 6 |
michael@0 | 731 | #define PR_BITS_PER_FLOAT_LOG2 5 |
michael@0 | 732 | #define PR_BITS_PER_DOUBLE_LOG2 6 |
michael@0 | 733 | #define PR_BITS_PER_WORD_LOG2 6 |
michael@0 | 734 | |
michael@0 | 735 | #define PR_ALIGN_OF_SHORT 2 |
michael@0 | 736 | #define PR_ALIGN_OF_INT 4 |
michael@0 | 737 | #define PR_ALIGN_OF_LONG 8 |
michael@0 | 738 | #define PR_ALIGN_OF_INT64 8 |
michael@0 | 739 | #define PR_ALIGN_OF_FLOAT 4 |
michael@0 | 740 | #define PR_ALIGN_OF_DOUBLE 8 |
michael@0 | 741 | #define PR_ALIGN_OF_POINTER 8 |
michael@0 | 742 | #define PR_ALIGN_OF_WORD 8 |
michael@0 | 743 | |
michael@0 | 744 | #define PR_BYTES_PER_WORD_LOG2 3 |
michael@0 | 745 | #define PR_BYTES_PER_DWORD_LOG2 3 |
michael@0 | 746 | |
michael@0 | 747 | #elif defined(__s390__) |
michael@0 | 748 | |
michael@0 | 749 | #define IS_BIG_ENDIAN 1 |
michael@0 | 750 | #undef IS_LITTLE_ENDIAN |
michael@0 | 751 | |
michael@0 | 752 | #define PR_BYTES_PER_BYTE 1 |
michael@0 | 753 | #define PR_BYTES_PER_SHORT 2 |
michael@0 | 754 | #define PR_BYTES_PER_INT 4 |
michael@0 | 755 | #define PR_BYTES_PER_INT64 8 |
michael@0 | 756 | #define PR_BYTES_PER_LONG 4 |
michael@0 | 757 | #define PR_BYTES_PER_FLOAT 4 |
michael@0 | 758 | #define PR_BYTES_PER_DOUBLE 8 |
michael@0 | 759 | #define PR_BYTES_PER_WORD 4 |
michael@0 | 760 | #define PR_BYTES_PER_DWORD 8 |
michael@0 | 761 | |
michael@0 | 762 | #define PR_BITS_PER_BYTE 8 |
michael@0 | 763 | #define PR_BITS_PER_SHORT 16 |
michael@0 | 764 | #define PR_BITS_PER_INT 32 |
michael@0 | 765 | #define PR_BITS_PER_INT64 64 |
michael@0 | 766 | #define PR_BITS_PER_LONG 32 |
michael@0 | 767 | #define PR_BITS_PER_FLOAT 32 |
michael@0 | 768 | #define PR_BITS_PER_DOUBLE 64 |
michael@0 | 769 | #define PR_BITS_PER_WORD 32 |
michael@0 | 770 | |
michael@0 | 771 | #define PR_BITS_PER_BYTE_LOG2 3 |
michael@0 | 772 | #define PR_BITS_PER_SHORT_LOG2 4 |
michael@0 | 773 | #define PR_BITS_PER_INT_LOG2 5 |
michael@0 | 774 | #define PR_BITS_PER_INT64_LOG2 6 |
michael@0 | 775 | #define PR_BITS_PER_LONG_LOG2 5 |
michael@0 | 776 | #define PR_BITS_PER_FLOAT_LOG2 5 |
michael@0 | 777 | #define PR_BITS_PER_DOUBLE_LOG2 6 |
michael@0 | 778 | #define PR_BITS_PER_WORD_LOG2 5 |
michael@0 | 779 | |
michael@0 | 780 | #define PR_ALIGN_OF_SHORT 2 |
michael@0 | 781 | #define PR_ALIGN_OF_INT 4 |
michael@0 | 782 | #define PR_ALIGN_OF_LONG 4 |
michael@0 | 783 | #define PR_ALIGN_OF_INT64 4 |
michael@0 | 784 | #define PR_ALIGN_OF_FLOAT 4 |
michael@0 | 785 | #define PR_ALIGN_OF_DOUBLE 4 |
michael@0 | 786 | #define PR_ALIGN_OF_POINTER 4 |
michael@0 | 787 | #define PR_ALIGN_OF_WORD 4 |
michael@0 | 788 | |
michael@0 | 789 | #define PR_BYTES_PER_WORD_LOG2 2 |
michael@0 | 790 | #define PR_BYTES_PER_DWORD_LOG2 3 |
michael@0 | 791 | |
michael@0 | 792 | #elif defined(__sh__) |
michael@0 | 793 | |
michael@0 | 794 | #define IS_LITTLE_ENDIAN 1 |
michael@0 | 795 | #undef IS_BIG_ENDIAN |
michael@0 | 796 | |
michael@0 | 797 | #define PR_BYTES_PER_BYTE 1 |
michael@0 | 798 | #define PR_BYTES_PER_SHORT 2 |
michael@0 | 799 | #define PR_BYTES_PER_INT 4 |
michael@0 | 800 | #define PR_BYTES_PER_INT64 8 |
michael@0 | 801 | #define PR_BYTES_PER_LONG 4 |
michael@0 | 802 | #define PR_BYTES_PER_FLOAT 4 |
michael@0 | 803 | #define PR_BYTES_PER_DOUBLE 8 |
michael@0 | 804 | #define PR_BYTES_PER_WORD 4 |
michael@0 | 805 | #define PR_BYTES_PER_DWORD 8 |
michael@0 | 806 | |
michael@0 | 807 | #define PR_BITS_PER_BYTE 8 |
michael@0 | 808 | #define PR_BITS_PER_SHORT 16 |
michael@0 | 809 | #define PR_BITS_PER_INT 32 |
michael@0 | 810 | #define PR_BITS_PER_INT64 64 |
michael@0 | 811 | #define PR_BITS_PER_LONG 32 |
michael@0 | 812 | #define PR_BITS_PER_FLOAT 32 |
michael@0 | 813 | #define PR_BITS_PER_DOUBLE 64 |
michael@0 | 814 | #define PR_BITS_PER_WORD 32 |
michael@0 | 815 | |
michael@0 | 816 | #define PR_BITS_PER_BYTE_LOG2 3 |
michael@0 | 817 | #define PR_BITS_PER_SHORT_LOG2 4 |
michael@0 | 818 | #define PR_BITS_PER_INT_LOG2 5 |
michael@0 | 819 | #define PR_BITS_PER_INT64_LOG2 6 |
michael@0 | 820 | #define PR_BITS_PER_LONG_LOG2 5 |
michael@0 | 821 | #define PR_BITS_PER_FLOAT_LOG2 5 |
michael@0 | 822 | #define PR_BITS_PER_DOUBLE_LOG2 6 |
michael@0 | 823 | #define PR_BITS_PER_WORD_LOG2 5 |
michael@0 | 824 | |
michael@0 | 825 | #define PR_ALIGN_OF_SHORT 2 |
michael@0 | 826 | #define PR_ALIGN_OF_INT 4 |
michael@0 | 827 | #define PR_ALIGN_OF_LONG 4 |
michael@0 | 828 | #define PR_ALIGN_OF_INT64 4 |
michael@0 | 829 | #define PR_ALIGN_OF_FLOAT 4 |
michael@0 | 830 | #define PR_ALIGN_OF_DOUBLE 4 |
michael@0 | 831 | #define PR_ALIGN_OF_POINTER 4 |
michael@0 | 832 | #define PR_ALIGN_OF_WORD 4 |
michael@0 | 833 | |
michael@0 | 834 | #define PR_BYTES_PER_WORD_LOG2 2 |
michael@0 | 835 | #define PR_BYTES_PER_DWORD_LOG2 3 |
michael@0 | 836 | |
michael@0 | 837 | #elif defined(__avr32__) |
michael@0 | 838 | |
michael@0 | 839 | #undef IS_LITTLE_ENDIAN |
michael@0 | 840 | #define IS_BIG_ENDIAN 1 |
michael@0 | 841 | |
michael@0 | 842 | #define PR_BYTES_PER_BYTE 1 |
michael@0 | 843 | #define PR_BYTES_PER_SHORT 2 |
michael@0 | 844 | #define PR_BYTES_PER_INT 4 |
michael@0 | 845 | #define PR_BYTES_PER_INT64 8 |
michael@0 | 846 | #define PR_BYTES_PER_LONG 4 |
michael@0 | 847 | #define PR_BYTES_PER_FLOAT 4 |
michael@0 | 848 | #define PR_BYTES_PER_DOUBLE 8 |
michael@0 | 849 | #define PR_BYTES_PER_WORD 4 |
michael@0 | 850 | #define PR_BYTES_PER_DWORD 8 |
michael@0 | 851 | |
michael@0 | 852 | #define PR_BITS_PER_BYTE 8 |
michael@0 | 853 | #define PR_BITS_PER_SHORT 16 |
michael@0 | 854 | #define PR_BITS_PER_INT 32 |
michael@0 | 855 | #define PR_BITS_PER_INT64 64 |
michael@0 | 856 | #define PR_BITS_PER_LONG 32 |
michael@0 | 857 | #define PR_BITS_PER_FLOAT 32 |
michael@0 | 858 | #define PR_BITS_PER_DOUBLE 64 |
michael@0 | 859 | #define PR_BITS_PER_WORD 32 |
michael@0 | 860 | |
michael@0 | 861 | #define PR_BITS_PER_BYTE_LOG2 3 |
michael@0 | 862 | #define PR_BITS_PER_SHORT_LOG2 4 |
michael@0 | 863 | #define PR_BITS_PER_INT_LOG2 5 |
michael@0 | 864 | #define PR_BITS_PER_INT64_LOG2 6 |
michael@0 | 865 | #define PR_BITS_PER_LONG_LOG2 5 |
michael@0 | 866 | #define PR_BITS_PER_FLOAT_LOG2 5 |
michael@0 | 867 | #define PR_BITS_PER_DOUBLE_LOG2 6 |
michael@0 | 868 | #define PR_BITS_PER_WORD_LOG2 5 |
michael@0 | 869 | |
michael@0 | 870 | #define PR_ALIGN_OF_SHORT 2 |
michael@0 | 871 | #define PR_ALIGN_OF_INT 4 |
michael@0 | 872 | #define PR_ALIGN_OF_LONG 4 |
michael@0 | 873 | #define PR_ALIGN_OF_INT64 4 |
michael@0 | 874 | #define PR_ALIGN_OF_FLOAT 4 |
michael@0 | 875 | #define PR_ALIGN_OF_DOUBLE 4 |
michael@0 | 876 | #define PR_ALIGN_OF_POINTER 4 |
michael@0 | 877 | #define PR_ALIGN_OF_WORD 4 |
michael@0 | 878 | |
michael@0 | 879 | #define PR_BYTES_PER_WORD_LOG2 2 |
michael@0 | 880 | #define PR_BYTES_PER_DWORD_LOG2 3 |
michael@0 | 881 | |
michael@0 | 882 | #elif defined(__m32r__) |
michael@0 | 883 | |
michael@0 | 884 | #undef IS_LITTLE_ENDIAN |
michael@0 | 885 | #define IS_BIG_ENDIAN 1 |
michael@0 | 886 | |
michael@0 | 887 | #define PR_BYTES_PER_BYTE 1 |
michael@0 | 888 | #define PR_BYTES_PER_SHORT 2 |
michael@0 | 889 | #define PR_BYTES_PER_INT 4 |
michael@0 | 890 | #define PR_BYTES_PER_INT64 8 |
michael@0 | 891 | #define PR_BYTES_PER_LONG 4 |
michael@0 | 892 | #define PR_BYTES_PER_FLOAT 4 |
michael@0 | 893 | #define PR_BYTES_PER_DOUBLE 8 |
michael@0 | 894 | #define PR_BYTES_PER_WORD 4 |
michael@0 | 895 | #define PR_BYTES_PER_DWORD 8 |
michael@0 | 896 | |
michael@0 | 897 | #define PR_BITS_PER_BYTE 8 |
michael@0 | 898 | #define PR_BITS_PER_SHORT 16 |
michael@0 | 899 | #define PR_BITS_PER_INT 32 |
michael@0 | 900 | #define PR_BITS_PER_INT64 64 |
michael@0 | 901 | #define PR_BITS_PER_LONG 32 |
michael@0 | 902 | #define PR_BITS_PER_FLOAT 32 |
michael@0 | 903 | #define PR_BITS_PER_DOUBLE 64 |
michael@0 | 904 | #define PR_BITS_PER_WORD 32 |
michael@0 | 905 | |
michael@0 | 906 | #define PR_BITS_PER_BYTE_LOG2 3 |
michael@0 | 907 | #define PR_BITS_PER_SHORT_LOG2 4 |
michael@0 | 908 | #define PR_BITS_PER_INT_LOG2 5 |
michael@0 | 909 | #define PR_BITS_PER_INT64_LOG2 6 |
michael@0 | 910 | #define PR_BITS_PER_LONG_LOG2 5 |
michael@0 | 911 | #define PR_BITS_PER_FLOAT_LOG2 5 |
michael@0 | 912 | #define PR_BITS_PER_DOUBLE_LOG2 6 |
michael@0 | 913 | #define PR_BITS_PER_WORD_LOG2 5 |
michael@0 | 914 | |
michael@0 | 915 | #define PR_ALIGN_OF_SHORT 2 |
michael@0 | 916 | #define PR_ALIGN_OF_INT 4 |
michael@0 | 917 | #define PR_ALIGN_OF_LONG 4 |
michael@0 | 918 | #define PR_ALIGN_OF_INT64 4 |
michael@0 | 919 | #define PR_ALIGN_OF_FLOAT 4 |
michael@0 | 920 | #define PR_ALIGN_OF_DOUBLE 4 |
michael@0 | 921 | #define PR_ALIGN_OF_POINTER 4 |
michael@0 | 922 | #define PR_ALIGN_OF_WORD 4 |
michael@0 | 923 | |
michael@0 | 924 | #define PR_BYTES_PER_WORD_LOG2 2 |
michael@0 | 925 | #define PR_BYTES_PER_DWORD_LOG2 3 |
michael@0 | 926 | |
michael@0 | 927 | #else |
michael@0 | 928 | |
michael@0 | 929 | #error "Unknown CPU architecture" |
michael@0 | 930 | |
michael@0 | 931 | #endif |
michael@0 | 932 | |
michael@0 | 933 | #ifndef HAVE_LONG_LONG |
michael@0 | 934 | #define HAVE_LONG_LONG |
michael@0 | 935 | #endif |
michael@0 | 936 | #if PR_ALIGN_OF_DOUBLE == 8 |
michael@0 | 937 | #define HAVE_ALIGNED_DOUBLES |
michael@0 | 938 | #endif |
michael@0 | 939 | #if PR_ALIGN_OF_INT64 == 8 |
michael@0 | 940 | #define HAVE_ALIGNED_LONGLONGS |
michael@0 | 941 | #endif |
michael@0 | 942 | |
michael@0 | 943 | #ifndef NO_NSPR_10_SUPPORT |
michael@0 | 944 | |
michael@0 | 945 | #define BYTES_PER_BYTE PR_BYTES_PER_BYTE |
michael@0 | 946 | #define BYTES_PER_SHORT PR_BYTES_PER_SHORT |
michael@0 | 947 | #define BYTES_PER_INT PR_BYTES_PER_INT |
michael@0 | 948 | #define BYTES_PER_INT64 PR_BYTES_PER_INT64 |
michael@0 | 949 | #define BYTES_PER_LONG PR_BYTES_PER_LONG |
michael@0 | 950 | #define BYTES_PER_FLOAT PR_BYTES_PER_FLOAT |
michael@0 | 951 | #define BYTES_PER_DOUBLE PR_BYTES_PER_DOUBLE |
michael@0 | 952 | #define BYTES_PER_WORD PR_BYTES_PER_WORD |
michael@0 | 953 | #define BYTES_PER_DWORD PR_BYTES_PER_DWORD |
michael@0 | 954 | |
michael@0 | 955 | #define BITS_PER_BYTE PR_BITS_PER_BYTE |
michael@0 | 956 | #define BITS_PER_SHORT PR_BITS_PER_SHORT |
michael@0 | 957 | #define BITS_PER_INT PR_BITS_PER_INT |
michael@0 | 958 | #define BITS_PER_INT64 PR_BITS_PER_INT64 |
michael@0 | 959 | #define BITS_PER_LONG PR_BITS_PER_LONG |
michael@0 | 960 | #define BITS_PER_FLOAT PR_BITS_PER_FLOAT |
michael@0 | 961 | #define BITS_PER_DOUBLE PR_BITS_PER_DOUBLE |
michael@0 | 962 | #define BITS_PER_WORD PR_BITS_PER_WORD |
michael@0 | 963 | |
michael@0 | 964 | #define BITS_PER_BYTE_LOG2 PR_BITS_PER_BYTE_LOG2 |
michael@0 | 965 | #define BITS_PER_SHORT_LOG2 PR_BITS_PER_SHORT_LOG2 |
michael@0 | 966 | #define BITS_PER_INT_LOG2 PR_BITS_PER_INT_LOG2 |
michael@0 | 967 | #define BITS_PER_INT64_LOG2 PR_BITS_PER_INT64_LOG2 |
michael@0 | 968 | #define BITS_PER_LONG_LOG2 PR_BITS_PER_LONG_LOG2 |
michael@0 | 969 | #define BITS_PER_FLOAT_LOG2 PR_BITS_PER_FLOAT_LOG2 |
michael@0 | 970 | #define BITS_PER_DOUBLE_LOG2 PR_BITS_PER_DOUBLE_LOG2 |
michael@0 | 971 | #define BITS_PER_WORD_LOG2 PR_BITS_PER_WORD_LOG2 |
michael@0 | 972 | |
michael@0 | 973 | #define ALIGN_OF_SHORT PR_ALIGN_OF_SHORT |
michael@0 | 974 | #define ALIGN_OF_INT PR_ALIGN_OF_INT |
michael@0 | 975 | #define ALIGN_OF_LONG PR_ALIGN_OF_LONG |
michael@0 | 976 | #define ALIGN_OF_INT64 PR_ALIGN_OF_INT64 |
michael@0 | 977 | #define ALIGN_OF_FLOAT PR_ALIGN_OF_FLOAT |
michael@0 | 978 | #define ALIGN_OF_DOUBLE PR_ALIGN_OF_DOUBLE |
michael@0 | 979 | #define ALIGN_OF_POINTER PR_ALIGN_OF_POINTER |
michael@0 | 980 | #define ALIGN_OF_WORD PR_ALIGN_OF_WORD |
michael@0 | 981 | |
michael@0 | 982 | #define BYTES_PER_WORD_LOG2 PR_BYTES_PER_WORD_LOG2 |
michael@0 | 983 | #define BYTES_PER_DWORD_LOG2 PR_BYTES_PER_DWORD_LOG2 |
michael@0 | 984 | #define WORDS_PER_DWORD_LOG2 PR_WORDS_PER_DWORD_LOG2 |
michael@0 | 985 | |
michael@0 | 986 | #endif /* NO_NSPR_10_SUPPORT */ |
michael@0 | 987 | |
michael@0 | 988 | #endif /* nspr_cpucfg___ */ |