File tree Expand file tree Collapse file tree 1 file changed +17
-13
lines changed
quaddtype/numpy_quaddtype/src Expand file tree Collapse file tree 1 file changed +17
-13
lines changed Original file line number Diff line number Diff line change 11
11
#include "numpy/arrayobject.h"
12
12
#include "numpy/dtype_api.h"
13
13
#include "numpy/ufuncobject.h"
14
+ #include "numpy/npy_endian.h"
14
15
15
16
#include "scalar.h"
16
17
#include "dtype.h"
@@ -33,23 +34,26 @@ py_is_longdouble_128(PyObject *self, PyObject *args)
33
34
#ifdef SLEEF_QUAD_C
34
35
static const Sleef_quad SMALLEST_SUBNORMAL_VALUE = SLEEF_QUAD_DENORM_MIN ;
35
36
#else
36
- // Use the exact same struct layout as the original buggy code
37
37
static const union {
38
38
struct {
39
- #if defined(__BYTE_ORDER__ ) && (__BYTE_ORDER__ == __ORDER_BIG_ENDIAN__ )
40
- uint64_t h , l ;
41
- #else
42
- uint64_t l , h ;
43
- #endif
39
+ #if NPY_BYTE_ORDER == NPY_BIG_ENDIAN
40
+ uint64_t high ;
41
+ uint64_t low ;
42
+ #elif NPY_BYTE_ORDER == NPY_LITTLE_ENDIAN
43
+ uint64_t low ;
44
+ uint64_t high ;
45
+ #else
46
+ #error "Unknown endianness - NPY_BYTE_ORDER not properly defined"
47
+ #endif
44
48
} parts ;
45
49
Sleef_quad value ;
46
- } smallest_subnormal_const = {. parts = {
47
- #if defined( __BYTE_ORDER__ ) && ( __BYTE_ORDER__ == __ORDER_BIG_ENDIAN__ )
48
- . h = 0x0000000000000000ULL , . l = 0x0000000000000001ULL
49
- #else
50
- . l = 0x0000000000000001ULL , . h = 0x0000000000000000ULL
51
- #endif
52
- }};
50
+ } smallest_subnormal_const = {
51
+ . parts = {
52
+ . low = 0x0000000000000001ULL ,
53
+ . high = 0x0000000000000000ULL
54
+ }
55
+ };
56
+
53
57
#define SMALLEST_SUBNORMAL_VALUE (smallest_subnormal_const.value)
54
58
#endif
55
59
You can’t perform that action at this time.
0 commit comments