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)
3131}
3232
3333#ifdef SLEEF_QUAD_C
34- // Native __float128 support
3534static const Sleef_quad SMALLEST_SUBNORMAL_VALUE = SLEEF_QUAD_DENORM_MIN ;
3635#else
37- // Use static union for thread-safe initialization
36+ // Use the exact same struct layout as the original buggy code
3837static const union {
3938 struct {
39+ #if defined(__BYTE_ORDER__ ) && (__BYTE_ORDER__ == __ORDER_BIG_ENDIAN__ )
40+ uint64_t h , l ;
41+ #else
4042 uint64_t l , h ;
43+ #endif
4144 } parts ;
4245 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+ }};
4453#define SMALLEST_SUBNORMAL_VALUE (smallest_subnormal_const.value)
4554#endif
4655
You can’t perform that action at this time.
0 commit comments