Skip to content

Commit e7104b7

Browse files
committed
precompile cache
1 parent 1ff0191 commit e7104b7

File tree

1 file changed

+12
-3
lines changed

1 file changed

+12
-3
lines changed

quaddtype/numpy_quaddtype/src/quaddtype_main.c

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff 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
3534
static 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
3837
static 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

0 commit comments

Comments
 (0)