npy_common.h
1 #ifndef NUMPY_CORE_INCLUDE_NUMPY_NPY_COMMON_H_ 2 #define NUMPY_CORE_INCLUDE_NUMPY_NPY_COMMON_H_ 3 4 /* need Python.h for npy_intp, npy_uintp */ 5 #include <Python.h> 6 7 /* numpconfig.h is auto-generated */ 8 #include "numpyconfig.h" 9 #ifdef HAVE_NPY_CONFIG_H 10 #include <npy_config.h> 11 #endif 12 13 /* 14 * using static inline modifiers when defining npy_math functions 15 * allows the compiler to make optimizations when possible 16 */ 17 #ifndef NPY_INLINE_MATH 18 #if defined(NPY_INTERNAL_BUILD) && NPY_INTERNAL_BUILD 19 #define NPY_INLINE_MATH 1 20 #else 21 #define NPY_INLINE_MATH 0 22 #endif 23 #endif 24 25 /* 26 * gcc does not unroll even with -O3 27 * use with care, unrolling on modern cpus rarely speeds things up 28 */ 29 #ifdef HAVE_ATTRIBUTE_OPTIMIZE_UNROLL_LOOPS 30 #define NPY_GCC_UNROLL_LOOPS \ 31 __attribute__((optimize("unroll-loops"))) 32 #else 33 #define NPY_GCC_UNROLL_LOOPS 34 #endif 35 36 /* highest gcc optimization level, enabled autovectorizer */ 37 #ifdef HAVE_ATTRIBUTE_OPTIMIZE_OPT_3 38 #define NPY_GCC_OPT_3 __attribute__((optimize("O3"))) 39 #else 40 #define NPY_GCC_OPT_3 41 #endif 42 43 /* compile target attributes */ 44 #if defined HAVE_ATTRIBUTE_TARGET_AVX && defined HAVE_LINK_AVX 45 #define NPY_GCC_TARGET_AVX __attribute__((target("avx"))) 46 #else 47 #define NPY_GCC_TARGET_AVX 48 #endif 49 50 #if defined HAVE_ATTRIBUTE_TARGET_AVX2_WITH_INTRINSICS 51 #define HAVE_ATTRIBUTE_TARGET_FMA 52 #define NPY_GCC_TARGET_FMA __attribute__((target("avx2,fma"))) 53 #endif 54 55 #if defined HAVE_ATTRIBUTE_TARGET_AVX2 && defined HAVE_LINK_AVX2 56 #define NPY_GCC_TARGET_AVX2 __attribute__((target("avx2"))) 57 #else 58 #define NPY_GCC_TARGET_AVX2 59 #endif 60 61 #if defined HAVE_ATTRIBUTE_TARGET_AVX512F && defined HAVE_LINK_AVX512F 62 #define NPY_GCC_TARGET_AVX512F __attribute__((target("avx512f"))) 63 #elif defined HAVE_ATTRIBUTE_TARGET_AVX512F_WITH_INTRINSICS 64 #define NPY_GCC_TARGET_AVX512F __attribute__((target("avx512f"))) 65 #else 66 #define NPY_GCC_TARGET_AVX512F 67 #endif 68 69 #if defined HAVE_ATTRIBUTE_TARGET_AVX512_SKX && defined HAVE_LINK_AVX512_SKX 70 #define NPY_GCC_TARGET_AVX512_SKX __attribute__((target("avx512f,avx512dq,avx512vl,avx512bw,avx512cd"))) 71 #elif defined HAVE_ATTRIBUTE_TARGET_AVX512_SKX_WITH_INTRINSICS 72 #define NPY_GCC_TARGET_AVX512_SKX __attribute__((target("avx512f,avx512dq,avx512vl,avx512bw,avx512cd"))) 73 #else 74 #define NPY_GCC_TARGET_AVX512_SKX 75 #endif 76 /* 77 * mark an argument (starting from 1) that must not be NULL and is not checked 78 * DO NOT USE IF FUNCTION CHECKS FOR NULL!! the compiler will remove the check 79 */ 80 #ifdef HAVE_ATTRIBUTE_NONNULL 81 #define NPY_GCC_NONNULL(n) __attribute__((nonnull(n))) 82 #else 83 #define NPY_GCC_NONNULL(n) 84 #endif 85 86 #if defined HAVE_XMMINTRIN_H && defined HAVE__MM_LOAD_PS 87 #define NPY_HAVE_SSE_INTRINSICS 88 #endif 89 90 #if defined HAVE_EMMINTRIN_H && defined HAVE__MM_LOAD_PD 91 #define NPY_HAVE_SSE2_INTRINSICS 92 #endif 93 94 #if defined HAVE_IMMINTRIN_H && defined HAVE_LINK_AVX2 95 #define NPY_HAVE_AVX2_INTRINSICS 96 #endif 97 98 #if defined HAVE_IMMINTRIN_H && defined HAVE_LINK_AVX512F 99 #define NPY_HAVE_AVX512F_INTRINSICS 100 #endif 101 /* 102 * give a hint to the compiler which branch is more likely or unlikely 103 * to occur, e.g. rare error cases: 104 * 105 * if (NPY_UNLIKELY(failure == 0)) 106 * return NULL; 107 * 108 * the double !! is to cast the expression (e.g. NULL) to a boolean required by 109 * the intrinsic 110 */ 111 #ifdef HAVE___BUILTIN_EXPECT 112 #define NPY_LIKELY(x) __builtin_expect(!!(x), 1) 113 #define NPY_UNLIKELY(x) __builtin_expect(!!(x), 0) 114 #else 115 #define NPY_LIKELY(x) (x) 116 #define NPY_UNLIKELY(x) (x) 117 #endif 118 119 #ifdef HAVE___BUILTIN_PREFETCH 120 /* unlike _mm_prefetch also works on non-x86 */ 121 #define NPY_PREFETCH(x, rw, loc) __builtin_prefetch((x), (rw), (loc)) 122 #else 123 #ifdef HAVE__MM_PREFETCH 124 /* _MM_HINT_ET[01] (rw = 1) unsupported, only available in gcc >= 4.9 */ 125 #define NPY_PREFETCH(x, rw, loc) _mm_prefetch((x), loc == 0 ? _MM_HINT_NTA : \ 126 (loc == 1 ? _MM_HINT_T2 : \ 127 (loc == 2 ? _MM_HINT_T1 : \ 128 (loc == 3 ? _MM_HINT_T0 : -1)))) 129 #else 130 #define NPY_PREFETCH(x, rw,loc) 131 #endif 132 #endif 133 134 #if defined(_MSC_VER) && !defined(__clang__) 135 #define NPY_INLINE __inline 136 /* clang included here to handle clang-cl on Windows */ 137 #elif defined(__GNUC__) || defined(__clang__) 138 #if defined(__STRICT_ANSI__) 139 #define NPY_INLINE __inline__ 140 #else 141 #define NPY_INLINE inline 142 #endif 143 #else 144 #define NPY_INLINE 145 #endif 146 147 #ifdef _MSC_VER 148 #define NPY_FINLINE static __forceinline 149 #elif defined(__GNUC__) 150 #define NPY_FINLINE static NPY_INLINE __attribute__((always_inline)) 151 #else 152 #define NPY_FINLINE static 153 #endif 154 155 #ifdef HAVE___THREAD 156 #define NPY_TLS __thread 157 #else 158 #ifdef HAVE___DECLSPEC_THREAD_ 159 #define NPY_TLS __declspec(thread) 160 #else 161 #define NPY_TLS 162 #endif 163 #endif 164 165 #ifdef WITH_CPYCHECKER_RETURNS_BORROWED_REF_ATTRIBUTE 166 #define NPY_RETURNS_BORROWED_REF \ 167 __attribute__((cpychecker_returns_borrowed_ref)) 168 #else 169 #define NPY_RETURNS_BORROWED_REF 170 #endif 171 172 #ifdef WITH_CPYCHECKER_STEALS_REFERENCE_TO_ARG_ATTRIBUTE 173 #define NPY_STEALS_REF_TO_ARG(n) \ 174 __attribute__((cpychecker_steals_reference_to_arg(n))) 175 #else 176 #define NPY_STEALS_REF_TO_ARG(n) 177 #endif 178 179 /* 64 bit file position support, also on win-amd64. Ticket #1660 */ 180 #if defined(_MSC_VER) && defined(_WIN64) && (_MSC_VER > 1400) || \ 181 defined(__MINGW32__) || defined(__MINGW64__) 182 #include <io.h> 183 184 #define npy_fseek _fseeki64 185 #define npy_ftell _ftelli64 186 #define npy_lseek _lseeki64 187 #define npy_off_t npy_int64 188 189 #if NPY_SIZEOF_INT == 8 190 #define NPY_OFF_T_PYFMT "i" 191 #elif NPY_SIZEOF_LONG == 8 192 #define NPY_OFF_T_PYFMT "l" 193 #elif NPY_SIZEOF_LONGLONG == 8 194 #define NPY_OFF_T_PYFMT "L" 195 #else 196 #error Unsupported size for type off_t 197 #endif 198 #else 199 #ifdef HAVE_FSEEKO 200 #define npy_fseek fseeko 201 #else 202 #define npy_fseek fseek 203 #endif 204 #ifdef HAVE_FTELLO 205 #define npy_ftell ftello 206 #else 207 #define npy_ftell ftell 208 #endif 209 #include <sys/types.h> 210 #define npy_lseek lseek 211 #define npy_off_t off_t 212 213 #if NPY_SIZEOF_OFF_T == NPY_SIZEOF_SHORT 214 #define NPY_OFF_T_PYFMT "h" 215 #elif NPY_SIZEOF_OFF_T == NPY_SIZEOF_INT 216 #define NPY_OFF_T_PYFMT "i" 217 #elif NPY_SIZEOF_OFF_T == NPY_SIZEOF_LONG 218 #define NPY_OFF_T_PYFMT "l" 219 #elif NPY_SIZEOF_OFF_T == NPY_SIZEOF_LONGLONG 220 #define NPY_OFF_T_PYFMT "L" 221 #else 222 #error Unsupported size for type off_t 223 #endif 224 #endif 225 226 /* enums for detected endianness */ 227 enum { 228 NPY_CPU_UNKNOWN_ENDIAN, 229 NPY_CPU_LITTLE, 230 NPY_CPU_BIG 231 }; 232 233 /* 234 * This is to typedef npy_intp to the appropriate pointer size for this 235 * platform. Py_intptr_t, Py_uintptr_t are defined in pyport.h. 236 */ 237 typedef Py_intptr_t npy_intp; 238 typedef Py_uintptr_t npy_uintp; 239 240 /* 241 * Define sizes that were not defined in numpyconfig.h. 242 */ 243 #define NPY_SIZEOF_CHAR 1 244 #define NPY_SIZEOF_BYTE 1 245 #define NPY_SIZEOF_DATETIME 8 246 #define NPY_SIZEOF_TIMEDELTA 8 247 #define NPY_SIZEOF_INTP NPY_SIZEOF_PY_INTPTR_T 248 #define NPY_SIZEOF_UINTP NPY_SIZEOF_PY_INTPTR_T 249 #define NPY_SIZEOF_HALF 2 250 #define NPY_SIZEOF_CFLOAT NPY_SIZEOF_COMPLEX_FLOAT 251 #define NPY_SIZEOF_CDOUBLE NPY_SIZEOF_COMPLEX_DOUBLE 252 #define NPY_SIZEOF_CLONGDOUBLE NPY_SIZEOF_COMPLEX_LONGDOUBLE 253 254 #ifdef constchar 255 #undef constchar 256 #endif 257 258 #define NPY_SSIZE_T_PYFMT "n" 259 #define constchar char 260 261 /* NPY_INTP_FMT Note: 262 * Unlike the other NPY_*_FMT macros, which are used with PyOS_snprintf, 263 * NPY_INTP_FMT is used with PyErr_Format and PyUnicode_FromFormat. Those 264 * functions use different formatting codes that are portably specified 265 * according to the Python documentation. See issue gh-2388. 266 */ 267 #if NPY_SIZEOF_PY_INTPTR_T == NPY_SIZEOF_INT 268 #define NPY_INTP NPY_INT 269 #define NPY_UINTP NPY_UINT 270 #define PyIntpArrType_Type PyIntArrType_Type 271 #define PyUIntpArrType_Type PyUIntArrType_Type 272 #define NPY_MAX_INTP NPY_MAX_INT 273 #define NPY_MIN_INTP NPY_MIN_INT 274 #define NPY_MAX_UINTP NPY_MAX_UINT 275 #define NPY_INTP_FMT "d" 276 #elif NPY_SIZEOF_PY_INTPTR_T == NPY_SIZEOF_LONG 277 #define NPY_INTP NPY_LONG 278 #define NPY_UINTP NPY_ULONG 279 #define PyIntpArrType_Type PyLongArrType_Type 280 #define PyUIntpArrType_Type PyULongArrType_Type 281 #define NPY_MAX_INTP NPY_MAX_LONG 282 #define NPY_MIN_INTP NPY_MIN_LONG 283 #define NPY_MAX_UINTP NPY_MAX_ULONG 284 #define NPY_INTP_FMT "ld" 285 #elif defined(PY_LONG_LONG) && (NPY_SIZEOF_PY_INTPTR_T == NPY_SIZEOF_LONGLONG) 286 #define NPY_INTP NPY_LONGLONG 287 #define NPY_UINTP NPY_ULONGLONG 288 #define PyIntpArrType_Type PyLongLongArrType_Type 289 #define PyUIntpArrType_Type PyULongLongArrType_Type 290 #define NPY_MAX_INTP NPY_MAX_LONGLONG 291 #define NPY_MIN_INTP NPY_MIN_LONGLONG 292 #define NPY_MAX_UINTP NPY_MAX_ULONGLONG 293 #define NPY_INTP_FMT "lld" 294 #endif 295 296 /* 297 * We can only use C99 formats for npy_int_p if it is the same as 298 * intp_t, hence the condition on HAVE_UNITPTR_T 299 */ 300 #if (NPY_USE_C99_FORMATS) == 1 \ 301 && (defined HAVE_UINTPTR_T) \ 302 && (defined HAVE_INTTYPES_H) 303 #include <inttypes.h> 304 #undef NPY_INTP_FMT 305 #define NPY_INTP_FMT PRIdPTR 306 #endif 307 308 309 /* 310 * Some platforms don't define bool, long long, or long double. 311 * Handle that here. 312 */ 313 #define NPY_BYTE_FMT "hhd" 314 #define NPY_UBYTE_FMT "hhu" 315 #define NPY_SHORT_FMT "hd" 316 #define NPY_USHORT_FMT "hu" 317 #define NPY_INT_FMT "d" 318 #define NPY_UINT_FMT "u" 319 #define NPY_LONG_FMT "ld" 320 #define NPY_ULONG_FMT "lu" 321 #define NPY_HALF_FMT "g" 322 #define NPY_FLOAT_FMT "g" 323 #define NPY_DOUBLE_FMT "g" 324 325 326 #ifdef PY_LONG_LONG 327 typedef PY_LONG_LONG npy_longlong; 328 typedef unsigned PY_LONG_LONG npy_ulonglong; 329 # ifdef _MSC_VER 330 # define NPY_LONGLONG_FMT "I64d" 331 # define NPY_ULONGLONG_FMT "I64u" 332 # else 333 # define NPY_LONGLONG_FMT "lld" 334 # define NPY_ULONGLONG_FMT "llu" 335 # endif 336 # ifdef _MSC_VER 337 # define NPY_LONGLONG_SUFFIX(x) (x##i64) 338 # define NPY_ULONGLONG_SUFFIX(x) (x##Ui64) 339 # else 340 # define NPY_LONGLONG_SUFFIX(x) (x##LL) 341 # define NPY_ULONGLONG_SUFFIX(x) (x##ULL) 342 # endif 343 #else 344 typedef long npy_longlong; 345 typedef unsigned long npy_ulonglong; 346 # define NPY_LONGLONG_SUFFIX(x) (x##L) 347 # define NPY_ULONGLONG_SUFFIX(x) (x##UL) 348 #endif 349 350 351 typedef unsigned char npy_bool; 352 #define NPY_FALSE 0 353 #define NPY_TRUE 1 354 /* 355 * `NPY_SIZEOF_LONGDOUBLE` isn't usually equal to sizeof(long double). 356 * In some certain cases, it may forced to be equal to sizeof(double) 357 * even against the compiler implementation and the same goes for 358 * `complex long double`. 359 * 360 * Therefore, avoid `long double`, use `npy_longdouble` instead, 361 * and when it comes to standard math functions make sure of using 362 * the double version when `NPY_SIZEOF_LONGDOUBLE` == `NPY_SIZEOF_DOUBLE`. 363 * For example: 364 * npy_longdouble *ptr, x; 365 * #if NPY_SIZEOF_LONGDOUBLE == NPY_SIZEOF_DOUBLE 366 * npy_longdouble r = modf(x, ptr); 367 * #else 368 * npy_longdouble r = modfl(x, ptr); 369 * #endif 370 * 371 * See https://github.com/numpy/numpy/issues/20348 372 */ 373 #if NPY_SIZEOF_LONGDOUBLE == NPY_SIZEOF_DOUBLE 374 #define NPY_LONGDOUBLE_FMT "g" 375 typedef double npy_longdouble; 376 #else 377 #define NPY_LONGDOUBLE_FMT "Lg" 378 typedef long double npy_longdouble; 379 #endif 380 381 #ifndef Py_USING_UNICODE 382 #error Must use Python with unicode enabled. 383 #endif 384 385 386 typedef signed char npy_byte; 387 typedef unsigned char npy_ubyte; 388 typedef unsigned short npy_ushort; 389 typedef unsigned int npy_uint; 390 typedef unsigned long npy_ulong; 391 392 /* These are for completeness */ 393 typedef char npy_char; 394 typedef short npy_short; 395 typedef int npy_int; 396 typedef long npy_long; 397 typedef float npy_float; 398 typedef double npy_double; 399 400 typedef Py_hash_t npy_hash_t; 401 #define NPY_SIZEOF_HASH_T NPY_SIZEOF_INTP 402 403 /* 404 * Disabling C99 complex usage: a lot of C code in numpy/scipy rely on being 405 * able to do .real/.imag. Will have to convert code first. 406 */ 407 #if 0 408 #if defined(NPY_USE_C99_COMPLEX) && defined(NPY_HAVE_COMPLEX_DOUBLE) 409 typedef complex npy_cdouble; 410 #else 411 typedef struct { double real, imag; } npy_cdouble; 412 #endif 413 414 #if defined(NPY_USE_C99_COMPLEX) && defined(NPY_HAVE_COMPLEX_FLOAT) 415 typedef complex float npy_cfloat; 416 #else 417 typedef struct { float real, imag; } npy_cfloat; 418 #endif 419 420 #if defined(NPY_USE_C99_COMPLEX) && defined(NPY_HAVE_COMPLEX_LONG_DOUBLE) 421 typedef complex long double npy_clongdouble; 422 #else 423 typedef struct {npy_longdouble real, imag;} npy_clongdouble; 424 #endif 425 #endif 426 #if NPY_SIZEOF_COMPLEX_DOUBLE != 2 * NPY_SIZEOF_DOUBLE 427 #error npy_cdouble definition is not compatible with C99 complex definition ! \ 428 Please contact NumPy maintainers and give detailed information about your \ 429 compiler and platform 430 #endif 431 typedef struct { double real, imag; } npy_cdouble; 432 433 #if NPY_SIZEOF_COMPLEX_FLOAT != 2 * NPY_SIZEOF_FLOAT 434 #error npy_cfloat definition is not compatible with C99 complex definition ! \ 435 Please contact NumPy maintainers and give detailed information about your \ 436 compiler and platform 437 #endif 438 typedef struct { float real, imag; } npy_cfloat; 439 440 #if NPY_SIZEOF_COMPLEX_LONGDOUBLE != 2 * NPY_SIZEOF_LONGDOUBLE 441 #error npy_clongdouble definition is not compatible with C99 complex definition ! \ 442 Please contact NumPy maintainers and give detailed information about your \ 443 compiler and platform 444 #endif 445 typedef struct { npy_longdouble real, imag; } npy_clongdouble; 446 447 /* 448 * numarray-style bit-width typedefs 449 */ 450 #define NPY_MAX_INT8 127 451 #define NPY_MIN_INT8 -128 452 #define NPY_MAX_UINT8 255 453 #define NPY_MAX_INT16 32767 454 #define NPY_MIN_INT16 -32768 455 #define NPY_MAX_UINT16 65535 456 #define NPY_MAX_INT32 2147483647 457 #define NPY_MIN_INT32 (-NPY_MAX_INT32 - 1) 458 #define NPY_MAX_UINT32 4294967295U 459 #define NPY_MAX_INT64 NPY_LONGLONG_SUFFIX(9223372036854775807) 460 #define NPY_MIN_INT64 (-NPY_MAX_INT64 - NPY_LONGLONG_SUFFIX(1)) 461 #define NPY_MAX_UINT64 NPY_ULONGLONG_SUFFIX(18446744073709551615) 462 #define NPY_MAX_INT128 NPY_LONGLONG_SUFFIX(85070591730234615865843651857942052864) 463 #define NPY_MIN_INT128 (-NPY_MAX_INT128 - NPY_LONGLONG_SUFFIX(1)) 464 #define NPY_MAX_UINT128 NPY_ULONGLONG_SUFFIX(170141183460469231731687303715884105728) 465 #define NPY_MAX_INT256 NPY_LONGLONG_SUFFIX(57896044618658097711785492504343953926634992332820282019728792003956564819967) 466 #define NPY_MIN_INT256 (-NPY_MAX_INT256 - NPY_LONGLONG_SUFFIX(1)) 467 #define NPY_MAX_UINT256 NPY_ULONGLONG_SUFFIX(115792089237316195423570985008687907853269984665640564039457584007913129639935) 468 #define NPY_MIN_DATETIME NPY_MIN_INT64 469 #define NPY_MAX_DATETIME NPY_MAX_INT64 470 #define NPY_MIN_TIMEDELTA NPY_MIN_INT64 471 #define NPY_MAX_TIMEDELTA NPY_MAX_INT64 472 473 /* Need to find the number of bits for each type and 474 make definitions accordingly. 475 476 C states that sizeof(char) == 1 by definition 477 478 So, just using the sizeof keyword won't help. 479 480 It also looks like Python itself uses sizeof(char) quite a 481 bit, which by definition should be 1 all the time. 482 483 Idea: Make Use of CHAR_BIT which should tell us how many 484 BITS per CHARACTER 485 */ 486 487 /* Include platform definitions -- These are in the C89/90 standard */ 488 #include <limits.h> 489 #define NPY_MAX_BYTE SCHAR_MAX 490 #define NPY_MIN_BYTE SCHAR_MIN 491 #define NPY_MAX_UBYTE UCHAR_MAX 492 #define NPY_MAX_SHORT SHRT_MAX 493 #define NPY_MIN_SHORT SHRT_MIN 494 #define NPY_MAX_USHORT USHRT_MAX 495 #define NPY_MAX_INT INT_MAX 496 #ifndef INT_MIN 497 #define INT_MIN (-INT_MAX - 1) 498 #endif 499 #define NPY_MIN_INT INT_MIN 500 #define NPY_MAX_UINT UINT_MAX 501 #define NPY_MAX_LONG LONG_MAX 502 #define NPY_MIN_LONG LONG_MIN 503 #define NPY_MAX_ULONG ULONG_MAX 504 505 #define NPY_BITSOF_BOOL (sizeof(npy_bool) * CHAR_BIT) 506 #define NPY_BITSOF_CHAR CHAR_BIT 507 #define NPY_BITSOF_BYTE (NPY_SIZEOF_BYTE * CHAR_BIT) 508 #define NPY_BITSOF_SHORT (NPY_SIZEOF_SHORT * CHAR_BIT) 509 #define NPY_BITSOF_INT (NPY_SIZEOF_INT * CHAR_BIT) 510 #define NPY_BITSOF_LONG (NPY_SIZEOF_LONG * CHAR_BIT) 511 #define NPY_BITSOF_LONGLONG (NPY_SIZEOF_LONGLONG * CHAR_BIT) 512 #define NPY_BITSOF_INTP (NPY_SIZEOF_INTP * CHAR_BIT) 513 #define NPY_BITSOF_HALF (NPY_SIZEOF_HALF * CHAR_BIT) 514 #define NPY_BITSOF_FLOAT (NPY_SIZEOF_FLOAT * CHAR_BIT) 515 #define NPY_BITSOF_DOUBLE (NPY_SIZEOF_DOUBLE * CHAR_BIT) 516 #define NPY_BITSOF_LONGDOUBLE (NPY_SIZEOF_LONGDOUBLE * CHAR_BIT) 517 #define NPY_BITSOF_CFLOAT (NPY_SIZEOF_CFLOAT * CHAR_BIT) 518 #define NPY_BITSOF_CDOUBLE (NPY_SIZEOF_CDOUBLE * CHAR_BIT) 519 #define NPY_BITSOF_CLONGDOUBLE (NPY_SIZEOF_CLONGDOUBLE * CHAR_BIT) 520 #define NPY_BITSOF_DATETIME (NPY_SIZEOF_DATETIME * CHAR_BIT) 521 #define NPY_BITSOF_TIMEDELTA (NPY_SIZEOF_TIMEDELTA * CHAR_BIT) 522 523 #if NPY_BITSOF_LONG == 8 524 #define NPY_INT8 NPY_LONG 525 #define NPY_UINT8 NPY_ULONG 526 typedef long npy_int8; 527 typedef unsigned long npy_uint8; 528 #define PyInt8ScalarObject PyLongScalarObject 529 #define PyInt8ArrType_Type PyLongArrType_Type 530 #define PyUInt8ScalarObject PyULongScalarObject 531 #define PyUInt8ArrType_Type PyULongArrType_Type 532 #define NPY_INT8_FMT NPY_LONG_FMT 533 #define NPY_UINT8_FMT NPY_ULONG_FMT 534 #elif NPY_BITSOF_LONG == 16 535 #define NPY_INT16 NPY_LONG 536 #define NPY_UINT16 NPY_ULONG 537 typedef long npy_int16; 538 typedef unsigned long npy_uint16; 539 #define PyInt16ScalarObject PyLongScalarObject 540 #define PyInt16ArrType_Type PyLongArrType_Type 541 #define PyUInt16ScalarObject PyULongScalarObject 542 #define PyUInt16ArrType_Type PyULongArrType_Type 543 #define NPY_INT16_FMT NPY_LONG_FMT 544 #define NPY_UINT16_FMT NPY_ULONG_FMT 545 #elif NPY_BITSOF_LONG == 32 546 #define NPY_INT32 NPY_LONG 547 #define NPY_UINT32 NPY_ULONG 548 typedef long npy_int32; 549 typedef unsigned long npy_uint32; 550 typedef unsigned long npy_ucs4; 551 #define PyInt32ScalarObject PyLongScalarObject 552 #define PyInt32ArrType_Type PyLongArrType_Type 553 #define PyUInt32ScalarObject PyULongScalarObject 554 #define PyUInt32ArrType_Type PyULongArrType_Type 555 #define NPY_INT32_FMT NPY_LONG_FMT 556 #define NPY_UINT32_FMT NPY_ULONG_FMT 557 #elif NPY_BITSOF_LONG == 64 558 #define NPY_INT64 NPY_LONG 559 #define NPY_UINT64 NPY_ULONG 560 typedef long npy_int64; 561 typedef unsigned long npy_uint64; 562 #define PyInt64ScalarObject PyLongScalarObject 563 #define PyInt64ArrType_Type PyLongArrType_Type 564 #define PyUInt64ScalarObject PyULongScalarObject 565 #define PyUInt64ArrType_Type PyULongArrType_Type 566 #define NPY_INT64_FMT NPY_LONG_FMT 567 #define NPY_UINT64_FMT NPY_ULONG_FMT 568 #define MyPyLong_FromInt64 PyLong_FromLong 569 #define MyPyLong_AsInt64 PyLong_AsLong 570 #elif NPY_BITSOF_LONG == 128 571 #define NPY_INT128 NPY_LONG 572 #define NPY_UINT128 NPY_ULONG 573 typedef long npy_int128; 574 typedef unsigned long npy_uint128; 575 #define PyInt128ScalarObject PyLongScalarObject 576 #define PyInt128ArrType_Type PyLongArrType_Type 577 #define PyUInt128ScalarObject PyULongScalarObject 578 #define PyUInt128ArrType_Type PyULongArrType_Type 579 #define NPY_INT128_FMT NPY_LONG_FMT 580 #define NPY_UINT128_FMT NPY_ULONG_FMT 581 #endif 582 583 #if NPY_BITSOF_LONGLONG == 8 584 # ifndef NPY_INT8 585 # define NPY_INT8 NPY_LONGLONG 586 # define NPY_UINT8 NPY_ULONGLONG 587 typedef npy_longlong npy_int8; 588 typedef npy_ulonglong npy_uint8; 589 # define PyInt8ScalarObject PyLongLongScalarObject 590 # define PyInt8ArrType_Type PyLongLongArrType_Type 591 # define PyUInt8ScalarObject PyULongLongScalarObject 592 # define PyUInt8ArrType_Type PyULongLongArrType_Type 593 #define NPY_INT8_FMT NPY_LONGLONG_FMT 594 #define NPY_UINT8_FMT NPY_ULONGLONG_FMT 595 # endif 596 # define NPY_MAX_LONGLONG NPY_MAX_INT8 597 # define NPY_MIN_LONGLONG NPY_MIN_INT8 598 # define NPY_MAX_ULONGLONG NPY_MAX_UINT8 599 #elif NPY_BITSOF_LONGLONG == 16 600 # ifndef NPY_INT16 601 # define NPY_INT16 NPY_LONGLONG 602 # define NPY_UINT16 NPY_ULONGLONG 603 typedef npy_longlong npy_int16; 604 typedef npy_ulonglong npy_uint16; 605 # define PyInt16ScalarObject PyLongLongScalarObject 606 # define PyInt16ArrType_Type PyLongLongArrType_Type 607 # define PyUInt16ScalarObject PyULongLongScalarObject 608 # define PyUInt16ArrType_Type PyULongLongArrType_Type 609 #define NPY_INT16_FMT NPY_LONGLONG_FMT 610 #define NPY_UINT16_FMT NPY_ULONGLONG_FMT 611 # endif 612 # define NPY_MAX_LONGLONG NPY_MAX_INT16 613 # define NPY_MIN_LONGLONG NPY_MIN_INT16 614 # define NPY_MAX_ULONGLONG NPY_MAX_UINT16 615 #elif NPY_BITSOF_LONGLONG == 32 616 # ifndef NPY_INT32 617 # define NPY_INT32 NPY_LONGLONG 618 # define NPY_UINT32 NPY_ULONGLONG 619 typedef npy_longlong npy_int32; 620 typedef npy_ulonglong npy_uint32; 621 typedef npy_ulonglong npy_ucs4; 622 # define PyInt32ScalarObject PyLongLongScalarObject 623 # define PyInt32ArrType_Type PyLongLongArrType_Type 624 # define PyUInt32ScalarObject PyULongLongScalarObject 625 # define PyUInt32ArrType_Type PyULongLongArrType_Type 626 #define NPY_INT32_FMT NPY_LONGLONG_FMT 627 #define NPY_UINT32_FMT NPY_ULONGLONG_FMT 628 # endif 629 # define NPY_MAX_LONGLONG NPY_MAX_INT32 630 # define NPY_MIN_LONGLONG NPY_MIN_INT32 631 # define NPY_MAX_ULONGLONG NPY_MAX_UINT32 632 #elif NPY_BITSOF_LONGLONG == 64 633 # ifndef NPY_INT64 634 # define NPY_INT64 NPY_LONGLONG 635 # define NPY_UINT64 NPY_ULONGLONG 636 typedef npy_longlong npy_int64; 637 typedef npy_ulonglong npy_uint64; 638 # define PyInt64ScalarObject PyLongLongScalarObject 639 # define PyInt64ArrType_Type PyLongLongArrType_Type 640 # define PyUInt64ScalarObject PyULongLongScalarObject 641 # define PyUInt64ArrType_Type PyULongLongArrType_Type 642 #define NPY_INT64_FMT NPY_LONGLONG_FMT 643 #define NPY_UINT64_FMT NPY_ULONGLONG_FMT 644 # define MyPyLong_FromInt64 PyLong_FromLongLong 645 # define MyPyLong_AsInt64 PyLong_AsLongLong 646 # endif 647 # define NPY_MAX_LONGLONG NPY_MAX_INT64 648 # define NPY_MIN_LONGLONG NPY_MIN_INT64 649 # define NPY_MAX_ULONGLONG NPY_MAX_UINT64 650 #elif NPY_BITSOF_LONGLONG == 128 651 # ifndef NPY_INT128 652 # define NPY_INT128 NPY_LONGLONG 653 # define NPY_UINT128 NPY_ULONGLONG 654 typedef npy_longlong npy_int128; 655 typedef npy_ulonglong npy_uint128; 656 # define PyInt128ScalarObject PyLongLongScalarObject 657 # define PyInt128ArrType_Type PyLongLongArrType_Type 658 # define PyUInt128ScalarObject PyULongLongScalarObject 659 # define PyUInt128ArrType_Type PyULongLongArrType_Type 660 #define NPY_INT128_FMT NPY_LONGLONG_FMT 661 #define NPY_UINT128_FMT NPY_ULONGLONG_FMT 662 # endif 663 # define NPY_MAX_LONGLONG NPY_MAX_INT128 664 # define NPY_MIN_LONGLONG NPY_MIN_INT128 665 # define NPY_MAX_ULONGLONG NPY_MAX_UINT128 666 #elif NPY_BITSOF_LONGLONG == 256 667 # define NPY_INT256 NPY_LONGLONG 668 # define NPY_UINT256 NPY_ULONGLONG 669 typedef npy_longlong npy_int256; 670 typedef npy_ulonglong npy_uint256; 671 # define PyInt256ScalarObject PyLongLongScalarObject 672 # define PyInt256ArrType_Type PyLongLongArrType_Type 673 # define PyUInt256ScalarObject PyULongLongScalarObject 674 # define PyUInt256ArrType_Type PyULongLongArrType_Type 675 #define NPY_INT256_FMT NPY_LONGLONG_FMT 676 #define NPY_UINT256_FMT NPY_ULONGLONG_FMT 677 # define NPY_MAX_LONGLONG NPY_MAX_INT256 678 # define NPY_MIN_LONGLONG NPY_MIN_INT256 679 # define NPY_MAX_ULONGLONG NPY_MAX_UINT256 680 #endif 681 682 #if NPY_BITSOF_INT == 8 683 #ifndef NPY_INT8 684 #define NPY_INT8 NPY_INT 685 #define NPY_UINT8 NPY_UINT 686 typedef int npy_int8; 687 typedef unsigned int npy_uint8; 688 # define PyInt8ScalarObject PyIntScalarObject 689 # define PyInt8ArrType_Type PyIntArrType_Type 690 # define PyUInt8ScalarObject PyUIntScalarObject 691 # define PyUInt8ArrType_Type PyUIntArrType_Type 692 #define NPY_INT8_FMT NPY_INT_FMT 693 #define NPY_UINT8_FMT NPY_UINT_FMT 694 #endif 695 #elif NPY_BITSOF_INT == 16 696 #ifndef NPY_INT16 697 #define NPY_INT16 NPY_INT 698 #define NPY_UINT16 NPY_UINT 699 typedef int npy_int16; 700 typedef unsigned int npy_uint16; 701 # define PyInt16ScalarObject PyIntScalarObject 702 # define PyInt16ArrType_Type PyIntArrType_Type 703 # define PyUInt16ScalarObject PyIntUScalarObject 704 # define PyUInt16ArrType_Type PyIntUArrType_Type 705 #define NPY_INT16_FMT NPY_INT_FMT 706 #define NPY_UINT16_FMT NPY_UINT_FMT 707 #endif 708 #elif NPY_BITSOF_INT == 32 709 #ifndef NPY_INT32 710 #define NPY_INT32 NPY_INT 711 #define NPY_UINT32 NPY_UINT 712 typedef int npy_int32; 713 typedef unsigned int npy_uint32; 714 typedef unsigned int npy_ucs4; 715 # define PyInt32ScalarObject PyIntScalarObject 716 # define PyInt32ArrType_Type PyIntArrType_Type 717 # define PyUInt32ScalarObject PyUIntScalarObject 718 # define PyUInt32ArrType_Type PyUIntArrType_Type 719 #define NPY_INT32_FMT NPY_INT_FMT 720 #define NPY_UINT32_FMT NPY_UINT_FMT 721 #endif 722 #elif NPY_BITSOF_INT == 64 723 #ifndef NPY_INT64 724 #define NPY_INT64 NPY_INT 725 #define NPY_UINT64 NPY_UINT 726 typedef int npy_int64; 727 typedef unsigned int npy_uint64; 728 # define PyInt64ScalarObject PyIntScalarObject 729 # define PyInt64ArrType_Type PyIntArrType_Type 730 # define PyUInt64ScalarObject PyUIntScalarObject 731 # define PyUInt64ArrType_Type PyUIntArrType_Type 732 #define NPY_INT64_FMT NPY_INT_FMT 733 #define NPY_UINT64_FMT NPY_UINT_FMT 734 # define MyPyLong_FromInt64 PyLong_FromLong 735 # define MyPyLong_AsInt64 PyLong_AsLong 736 #endif 737 #elif NPY_BITSOF_INT == 128 738 #ifndef NPY_INT128 739 #define NPY_INT128 NPY_INT 740 #define NPY_UINT128 NPY_UINT 741 typedef int npy_int128; 742 typedef unsigned int npy_uint128; 743 # define PyInt128ScalarObject PyIntScalarObject 744 # define PyInt128ArrType_Type PyIntArrType_Type 745 # define PyUInt128ScalarObject PyUIntScalarObject 746 # define PyUInt128ArrType_Type PyUIntArrType_Type 747 #define NPY_INT128_FMT NPY_INT_FMT 748 #define NPY_UINT128_FMT NPY_UINT_FMT 749 #endif 750 #endif 751 752 #if NPY_BITSOF_SHORT == 8 753 #ifndef NPY_INT8 754 #define NPY_INT8 NPY_SHORT 755 #define NPY_UINT8 NPY_USHORT 756 typedef short npy_int8; 757 typedef unsigned short npy_uint8; 758 # define PyInt8ScalarObject PyShortScalarObject 759 # define PyInt8ArrType_Type PyShortArrType_Type 760 # define PyUInt8ScalarObject PyUShortScalarObject 761 # define PyUInt8ArrType_Type PyUShortArrType_Type 762 #define NPY_INT8_FMT NPY_SHORT_FMT 763 #define NPY_UINT8_FMT NPY_USHORT_FMT 764 #endif 765 #elif NPY_BITSOF_SHORT == 16 766 #ifndef NPY_INT16 767 #define NPY_INT16 NPY_SHORT 768 #define NPY_UINT16 NPY_USHORT 769 typedef short npy_int16; 770 typedef unsigned short npy_uint16; 771 # define PyInt16ScalarObject PyShortScalarObject 772 # define PyInt16ArrType_Type PyShortArrType_Type 773 # define PyUInt16ScalarObject PyUShortScalarObject 774 # define PyUInt16ArrType_Type PyUShortArrType_Type 775 #define NPY_INT16_FMT NPY_SHORT_FMT 776 #define NPY_UINT16_FMT NPY_USHORT_FMT 777 #endif 778 #elif NPY_BITSOF_SHORT == 32 779 #ifndef NPY_INT32 780 #define NPY_INT32 NPY_SHORT 781 #define NPY_UINT32 NPY_USHORT 782 typedef short npy_int32; 783 typedef unsigned short npy_uint32; 784 typedef unsigned short npy_ucs4; 785 # define PyInt32ScalarObject PyShortScalarObject 786 # define PyInt32ArrType_Type PyShortArrType_Type 787 # define PyUInt32ScalarObject PyUShortScalarObject 788 # define PyUInt32ArrType_Type PyUShortArrType_Type 789 #define NPY_INT32_FMT NPY_SHORT_FMT 790 #define NPY_UINT32_FMT NPY_USHORT_FMT 791 #endif 792 #elif NPY_BITSOF_SHORT == 64 793 #ifndef NPY_INT64 794 #define NPY_INT64 NPY_SHORT 795 #define NPY_UINT64 NPY_USHORT 796 typedef short npy_int64; 797 typedef unsigned short npy_uint64; 798 # define PyInt64ScalarObject PyShortScalarObject 799 # define PyInt64ArrType_Type PyShortArrType_Type 800 # define PyUInt64ScalarObject PyUShortScalarObject 801 # define PyUInt64ArrType_Type PyUShortArrType_Type 802 #define NPY_INT64_FMT NPY_SHORT_FMT 803 #define NPY_UINT64_FMT NPY_USHORT_FMT 804 # define MyPyLong_FromInt64 PyLong_FromLong 805 # define MyPyLong_AsInt64 PyLong_AsLong 806 #endif 807 #elif NPY_BITSOF_SHORT == 128 808 #ifndef NPY_INT128 809 #define NPY_INT128 NPY_SHORT 810 #define NPY_UINT128 NPY_USHORT 811 typedef short npy_int128; 812 typedef unsigned short npy_uint128; 813 # define PyInt128ScalarObject PyShortScalarObject 814 # define PyInt128ArrType_Type PyShortArrType_Type 815 # define PyUInt128ScalarObject PyUShortScalarObject 816 # define PyUInt128ArrType_Type PyUShortArrType_Type 817 #define NPY_INT128_FMT NPY_SHORT_FMT 818 #define NPY_UINT128_FMT NPY_USHORT_FMT 819 #endif 820 #endif 821 822 823 #if NPY_BITSOF_CHAR == 8 824 #ifndef NPY_INT8 825 #define NPY_INT8 NPY_BYTE 826 #define NPY_UINT8 NPY_UBYTE 827 typedef signed char npy_int8; 828 typedef unsigned char npy_uint8; 829 # define PyInt8ScalarObject PyByteScalarObject 830 # define PyInt8ArrType_Type PyByteArrType_Type 831 # define PyUInt8ScalarObject PyUByteScalarObject 832 # define PyUInt8ArrType_Type PyUByteArrType_Type 833 #define NPY_INT8_FMT NPY_BYTE_FMT 834 #define NPY_UINT8_FMT NPY_UBYTE_FMT 835 #endif 836 #elif NPY_BITSOF_CHAR == 16 837 #ifndef NPY_INT16 838 #define NPY_INT16 NPY_BYTE 839 #define NPY_UINT16 NPY_UBYTE 840 typedef signed char npy_int16; 841 typedef unsigned char npy_uint16; 842 # define PyInt16ScalarObject PyByteScalarObject 843 # define PyInt16ArrType_Type PyByteArrType_Type 844 # define PyUInt16ScalarObject PyUByteScalarObject 845 # define PyUInt16ArrType_Type PyUByteArrType_Type 846 #define NPY_INT16_FMT NPY_BYTE_FMT 847 #define NPY_UINT16_FMT NPY_UBYTE_FMT 848 #endif 849 #elif NPY_BITSOF_CHAR == 32 850 #ifndef NPY_INT32 851 #define NPY_INT32 NPY_BYTE 852 #define NPY_UINT32 NPY_UBYTE 853 typedef signed char npy_int32; 854 typedef unsigned char npy_uint32; 855 typedef unsigned char npy_ucs4; 856 # define PyInt32ScalarObject PyByteScalarObject 857 # define PyInt32ArrType_Type PyByteArrType_Type 858 # define PyUInt32ScalarObject PyUByteScalarObject 859 # define PyUInt32ArrType_Type PyUByteArrType_Type 860 #define NPY_INT32_FMT NPY_BYTE_FMT 861 #define NPY_UINT32_FMT NPY_UBYTE_FMT 862 #endif 863 #elif NPY_BITSOF_CHAR == 64 864 #ifndef NPY_INT64 865 #define NPY_INT64 NPY_BYTE 866 #define NPY_UINT64 NPY_UBYTE 867 typedef signed char npy_int64; 868 typedef unsigned char npy_uint64; 869 # define PyInt64ScalarObject PyByteScalarObject 870 # define PyInt64ArrType_Type PyByteArrType_Type 871 # define PyUInt64ScalarObject PyUByteScalarObject 872 # define PyUInt64ArrType_Type PyUByteArrType_Type 873 #define NPY_INT64_FMT NPY_BYTE_FMT 874 #define NPY_UINT64_FMT NPY_UBYTE_FMT 875 # define MyPyLong_FromInt64 PyLong_FromLong 876 # define MyPyLong_AsInt64 PyLong_AsLong 877 #endif 878 #elif NPY_BITSOF_CHAR == 128 879 #ifndef NPY_INT128 880 #define NPY_INT128 NPY_BYTE 881 #define NPY_UINT128 NPY_UBYTE 882 typedef signed char npy_int128; 883 typedef unsigned char npy_uint128; 884 # define PyInt128ScalarObject PyByteScalarObject 885 # define PyInt128ArrType_Type PyByteArrType_Type 886 # define PyUInt128ScalarObject PyUByteScalarObject 887 # define PyUInt128ArrType_Type PyUByteArrType_Type 888 #define NPY_INT128_FMT NPY_BYTE_FMT 889 #define NPY_UINT128_FMT NPY_UBYTE_FMT 890 #endif 891 #endif 892 893 894 895 #if NPY_BITSOF_DOUBLE == 32 896 #ifndef NPY_FLOAT32 897 #define NPY_FLOAT32 NPY_DOUBLE 898 #define NPY_COMPLEX64 NPY_CDOUBLE 899 typedef double npy_float32; 900 typedef npy_cdouble npy_complex64; 901 # define PyFloat32ScalarObject PyDoubleScalarObject 902 # define PyComplex64ScalarObject PyCDoubleScalarObject 903 # define PyFloat32ArrType_Type PyDoubleArrType_Type 904 # define PyComplex64ArrType_Type PyCDoubleArrType_Type 905 #define NPY_FLOAT32_FMT NPY_DOUBLE_FMT 906 #define NPY_COMPLEX64_FMT NPY_CDOUBLE_FMT 907 #endif 908 #elif NPY_BITSOF_DOUBLE == 64 909 #ifndef NPY_FLOAT64 910 #define NPY_FLOAT64 NPY_DOUBLE 911 #define NPY_COMPLEX128 NPY_CDOUBLE 912 typedef double npy_float64; 913 typedef npy_cdouble npy_complex128; 914 # define PyFloat64ScalarObject PyDoubleScalarObject 915 # define PyComplex128ScalarObject PyCDoubleScalarObject 916 # define PyFloat64ArrType_Type PyDoubleArrType_Type 917 # define PyComplex128ArrType_Type PyCDoubleArrType_Type 918 #define NPY_FLOAT64_FMT NPY_DOUBLE_FMT 919 #define NPY_COMPLEX128_FMT NPY_CDOUBLE_FMT 920 #endif 921 #elif NPY_BITSOF_DOUBLE == 80 922 #ifndef NPY_FLOAT80 923 #define NPY_FLOAT80 NPY_DOUBLE 924 #define NPY_COMPLEX160 NPY_CDOUBLE 925 typedef double npy_float80; 926 typedef npy_cdouble npy_complex160; 927 # define PyFloat80ScalarObject PyDoubleScalarObject 928 # define PyComplex160ScalarObject PyCDoubleScalarObject 929 # define PyFloat80ArrType_Type PyDoubleArrType_Type 930 # define PyComplex160ArrType_Type PyCDoubleArrType_Type 931 #define NPY_FLOAT80_FMT NPY_DOUBLE_FMT 932 #define NPY_COMPLEX160_FMT NPY_CDOUBLE_FMT 933 #endif 934 #elif NPY_BITSOF_DOUBLE == 96 935 #ifndef NPY_FLOAT96 936 #define NPY_FLOAT96 NPY_DOUBLE 937 #define NPY_COMPLEX192 NPY_CDOUBLE 938 typedef double npy_float96; 939 typedef npy_cdouble npy_complex192; 940 # define PyFloat96ScalarObject PyDoubleScalarObject 941 # define PyComplex192ScalarObject PyCDoubleScalarObject 942 # define PyFloat96ArrType_Type PyDoubleArrType_Type 943 # define PyComplex192ArrType_Type PyCDoubleArrType_Type 944 #define NPY_FLOAT96_FMT NPY_DOUBLE_FMT 945 #define NPY_COMPLEX192_FMT NPY_CDOUBLE_FMT 946 #endif 947 #elif NPY_BITSOF_DOUBLE == 128 948 #ifndef NPY_FLOAT128 949 #define NPY_FLOAT128 NPY_DOUBLE 950 #define NPY_COMPLEX256 NPY_CDOUBLE 951 typedef double npy_float128; 952 typedef npy_cdouble npy_complex256; 953 # define PyFloat128ScalarObject PyDoubleScalarObject 954 # define PyComplex256ScalarObject PyCDoubleScalarObject 955 # define PyFloat128ArrType_Type PyDoubleArrType_Type 956 # define PyComplex256ArrType_Type PyCDoubleArrType_Type 957 #define NPY_FLOAT128_FMT NPY_DOUBLE_FMT 958 #define NPY_COMPLEX256_FMT NPY_CDOUBLE_FMT 959 #endif 960 #endif 961 962 963 964 #if NPY_BITSOF_FLOAT == 32 965 #ifndef NPY_FLOAT32 966 #define NPY_FLOAT32 NPY_FLOAT 967 #define NPY_COMPLEX64 NPY_CFLOAT 968 typedef float npy_float32; 969 typedef npy_cfloat npy_complex64; 970 # define PyFloat32ScalarObject PyFloatScalarObject 971 # define PyComplex64ScalarObject PyCFloatScalarObject 972 # define PyFloat32ArrType_Type PyFloatArrType_Type 973 # define PyComplex64ArrType_Type PyCFloatArrType_Type 974 #define NPY_FLOAT32_FMT NPY_FLOAT_FMT 975 #define NPY_COMPLEX64_FMT NPY_CFLOAT_FMT 976 #endif 977 #elif NPY_BITSOF_FLOAT == 64 978 #ifndef NPY_FLOAT64 979 #define NPY_FLOAT64 NPY_FLOAT 980 #define NPY_COMPLEX128 NPY_CFLOAT 981 typedef float npy_float64; 982 typedef npy_cfloat npy_complex128; 983 # define PyFloat64ScalarObject PyFloatScalarObject 984 # define PyComplex128ScalarObject PyCFloatScalarObject 985 # define PyFloat64ArrType_Type PyFloatArrType_Type 986 # define PyComplex128ArrType_Type PyCFloatArrType_Type 987 #define NPY_FLOAT64_FMT NPY_FLOAT_FMT 988 #define NPY_COMPLEX128_FMT NPY_CFLOAT_FMT 989 #endif 990 #elif NPY_BITSOF_FLOAT == 80 991 #ifndef NPY_FLOAT80 992 #define NPY_FLOAT80 NPY_FLOAT 993 #define NPY_COMPLEX160 NPY_CFLOAT 994 typedef float npy_float80; 995 typedef npy_cfloat npy_complex160; 996 # define PyFloat80ScalarObject PyFloatScalarObject 997 # define PyComplex160ScalarObject PyCFloatScalarObject 998 # define PyFloat80ArrType_Type PyFloatArrType_Type 999 # define PyComplex160ArrType_Type PyCFloatArrType_Type 1000 #define NPY_FLOAT80_FMT NPY_FLOAT_FMT 1001 #define NPY_COMPLEX160_FMT NPY_CFLOAT_FMT 1002 #endif 1003 #elif NPY_BITSOF_FLOAT == 96 1004 #ifndef NPY_FLOAT96 1005 #define NPY_FLOAT96 NPY_FLOAT 1006 #define NPY_COMPLEX192 NPY_CFLOAT 1007 typedef float npy_float96; 1008 typedef npy_cfloat npy_complex192; 1009 # define PyFloat96ScalarObject PyFloatScalarObject 1010 # define PyComplex192ScalarObject PyCFloatScalarObject 1011 # define PyFloat96ArrType_Type PyFloatArrType_Type 1012 # define PyComplex192ArrType_Type PyCFloatArrType_Type 1013 #define NPY_FLOAT96_FMT NPY_FLOAT_FMT 1014 #define NPY_COMPLEX192_FMT NPY_CFLOAT_FMT 1015 #endif 1016 #elif NPY_BITSOF_FLOAT == 128 1017 #ifndef NPY_FLOAT128 1018 #define NPY_FLOAT128 NPY_FLOAT 1019 #define NPY_COMPLEX256 NPY_CFLOAT 1020 typedef float npy_float128; 1021 typedef npy_cfloat npy_complex256; 1022 # define PyFloat128ScalarObject PyFloatScalarObject 1023 # define PyComplex256ScalarObject PyCFloatScalarObject 1024 # define PyFloat128ArrType_Type PyFloatArrType_Type 1025 # define PyComplex256ArrType_Type PyCFloatArrType_Type 1026 #define NPY_FLOAT128_FMT NPY_FLOAT_FMT 1027 #define NPY_COMPLEX256_FMT NPY_CFLOAT_FMT 1028 #endif 1029 #endif 1030 1031 /* half/float16 isn't a floating-point type in C */ 1032 #define NPY_FLOAT16 NPY_HALF 1033 typedef npy_uint16 npy_half; 1034 typedef npy_half npy_float16; 1035 1036 #if NPY_BITSOF_LONGDOUBLE == 32 1037 #ifndef NPY_FLOAT32 1038 #define NPY_FLOAT32 NPY_LONGDOUBLE 1039 #define NPY_COMPLEX64 NPY_CLONGDOUBLE 1040 typedef npy_longdouble npy_float32; 1041 typedef npy_clongdouble npy_complex64; 1042 # define PyFloat32ScalarObject PyLongDoubleScalarObject 1043 # define PyComplex64ScalarObject PyCLongDoubleScalarObject 1044 # define PyFloat32ArrType_Type PyLongDoubleArrType_Type 1045 # define PyComplex64ArrType_Type PyCLongDoubleArrType_Type 1046 #define NPY_FLOAT32_FMT NPY_LONGDOUBLE_FMT 1047 #define NPY_COMPLEX64_FMT NPY_CLONGDOUBLE_FMT 1048 #endif 1049 #elif NPY_BITSOF_LONGDOUBLE == 64 1050 #ifndef NPY_FLOAT64 1051 #define NPY_FLOAT64 NPY_LONGDOUBLE 1052 #define NPY_COMPLEX128 NPY_CLONGDOUBLE 1053 typedef npy_longdouble npy_float64; 1054 typedef npy_clongdouble npy_complex128; 1055 # define PyFloat64ScalarObject PyLongDoubleScalarObject 1056 # define PyComplex128ScalarObject PyCLongDoubleScalarObject 1057 # define PyFloat64ArrType_Type PyLongDoubleArrType_Type 1058 # define PyComplex128ArrType_Type PyCLongDoubleArrType_Type 1059 #define NPY_FLOAT64_FMT NPY_LONGDOUBLE_FMT 1060 #define NPY_COMPLEX128_FMT NPY_CLONGDOUBLE_FMT 1061 #endif 1062 #elif NPY_BITSOF_LONGDOUBLE == 80 1063 #ifndef NPY_FLOAT80 1064 #define NPY_FLOAT80 NPY_LONGDOUBLE 1065 #define NPY_COMPLEX160 NPY_CLONGDOUBLE 1066 typedef npy_longdouble npy_float80; 1067 typedef npy_clongdouble npy_complex160; 1068 # define PyFloat80ScalarObject PyLongDoubleScalarObject 1069 # define PyComplex160ScalarObject PyCLongDoubleScalarObject 1070 # define PyFloat80ArrType_Type PyLongDoubleArrType_Type 1071 # define PyComplex160ArrType_Type PyCLongDoubleArrType_Type 1072 #define NPY_FLOAT80_FMT NPY_LONGDOUBLE_FMT 1073 #define NPY_COMPLEX160_FMT NPY_CLONGDOUBLE_FMT 1074 #endif 1075 #elif NPY_BITSOF_LONGDOUBLE == 96 1076 #ifndef NPY_FLOAT96 1077 #define NPY_FLOAT96 NPY_LONGDOUBLE 1078 #define NPY_COMPLEX192 NPY_CLONGDOUBLE 1079 typedef npy_longdouble npy_float96; 1080 typedef npy_clongdouble npy_complex192; 1081 # define PyFloat96ScalarObject PyLongDoubleScalarObject 1082 # define PyComplex192ScalarObject PyCLongDoubleScalarObject 1083 # define PyFloat96ArrType_Type PyLongDoubleArrType_Type 1084 # define PyComplex192ArrType_Type PyCLongDoubleArrType_Type 1085 #define NPY_FLOAT96_FMT NPY_LONGDOUBLE_FMT 1086 #define NPY_COMPLEX192_FMT NPY_CLONGDOUBLE_FMT 1087 #endif 1088 #elif NPY_BITSOF_LONGDOUBLE == 128 1089 #ifndef NPY_FLOAT128 1090 #define NPY_FLOAT128 NPY_LONGDOUBLE 1091 #define NPY_COMPLEX256 NPY_CLONGDOUBLE 1092 typedef npy_longdouble npy_float128; 1093 typedef npy_clongdouble npy_complex256; 1094 # define PyFloat128ScalarObject PyLongDoubleScalarObject 1095 # define PyComplex256ScalarObject PyCLongDoubleScalarObject 1096 # define PyFloat128ArrType_Type PyLongDoubleArrType_Type 1097 # define PyComplex256ArrType_Type PyCLongDoubleArrType_Type 1098 #define NPY_FLOAT128_FMT NPY_LONGDOUBLE_FMT 1099 #define NPY_COMPLEX256_FMT NPY_CLONGDOUBLE_FMT 1100 #endif 1101 #elif NPY_BITSOF_LONGDOUBLE == 256 1102 #define NPY_FLOAT256 NPY_LONGDOUBLE 1103 #define NPY_COMPLEX512 NPY_CLONGDOUBLE 1104 typedef npy_longdouble npy_float256; 1105 typedef npy_clongdouble npy_complex512; 1106 # define PyFloat256ScalarObject PyLongDoubleScalarObject 1107 # define PyComplex512ScalarObject PyCLongDoubleScalarObject 1108 # define PyFloat256ArrType_Type PyLongDoubleArrType_Type 1109 # define PyComplex512ArrType_Type PyCLongDoubleArrType_Type 1110 #define NPY_FLOAT256_FMT NPY_LONGDOUBLE_FMT 1111 #define NPY_COMPLEX512_FMT NPY_CLONGDOUBLE_FMT 1112 #endif 1113 1114 /* datetime typedefs */ 1115 typedef npy_int64 npy_timedelta; 1116 typedef npy_int64 npy_datetime; 1117 #define NPY_DATETIME_FMT NPY_INT64_FMT 1118 #define NPY_TIMEDELTA_FMT NPY_INT64_FMT 1119 1120 /* End of typedefs for numarray style bit-width names */ 1121 1122 #endif /* NUMPY_CORE_INCLUDE_NUMPY_NPY_COMMON_H_ */