File tree Expand file tree Collapse file tree 1 file changed +12
-3
lines changed
quaddtype/numpy_quaddtype/src Expand file tree Collapse file tree 1 file changed +12
-3
lines changed Original file line number Diff line number Diff line change @@ -31,16 +31,25 @@ py_is_longdouble_128(PyObject *self, PyObject *args)
31
31
}
32
32
33
33
#ifdef SLEEF_QUAD_C
34
- // Native __float128 support
35
34
static const Sleef_quad SMALLEST_SUBNORMAL_VALUE = SLEEF_QUAD_DENORM_MIN ;
36
35
#else
37
- // Use static union for thread-safe initialization
36
+ // Use the exact same struct layout as the original buggy code
38
37
static const union {
39
38
struct {
39
+ #if defined(__BYTE_ORDER__ ) && (__BYTE_ORDER__ == __ORDER_BIG_ENDIAN__ )
40
+ uint64_t h , l ;
41
+ #else
40
42
uint64_t l , h ;
43
+ #endif
41
44
} parts ;
42
45
Sleef_quad value ;
43
- } smallest_subnormal_const = {.parts = {.l = 0x0000000000000001ULL , .h = 0x0000000000000000ULL }};
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
+ }};
44
53
#define SMALLEST_SUBNORMAL_VALUE (smallest_subnormal_const.value)
45
54
#endif
46
55
You can’t perform that action at this time.
0 commit comments