Commit c92189e7 authored by Mark Florisson's avatar Mark Florisson Committed by Dag Sverre Seljebotn

Remove platform-specific NaN initialization

parent a002ad59
...@@ -117,9 +117,6 @@ api_guard_prefix = "__PYX_HAVE_API__" ...@@ -117,9 +117,6 @@ api_guard_prefix = "__PYX_HAVE_API__"
api_func_guard = "__PYX_HAVE_API_FUNC_" api_func_guard = "__PYX_HAVE_API_FUNC_"
PYX_NAN = "__PYX_NAN" PYX_NAN = "__PYX_NAN"
HUGE_VAL = "Py_HUGE_VAL"
LONG_LONG_MAX = "__PYX_LONG_LONG_MAX"
ULONG_LONG_MAX = "__PYX_ULONG_LONG_MAX"
def py_version_hex(major, minor=0, micro=0, release_level=0, release_serial=0): def py_version_hex(major, minor=0, micro=0, release_level=0, release_serial=0):
return (major << 24) | (minor << 16) | (micro << 8) | (release_level << 4) | (release_serial) return (major << 24) | (minor << 16) | (micro << 8) | (release_level << 4) | (release_serial)
...@@ -7592,36 +7592,19 @@ bad: ...@@ -7592,36 +7592,19 @@ bad:
################ Utility code for cython.parallel stuff ################ ################ Utility code for cython.parallel stuff ################
invalid_values_utility_code = UtilityCode(proto=""" invalid_values_utility_code = UtilityCode(
#ifdef HAVE_LONG_LONG proto="""\
#define %(LONG_LONG_MAX)s PY_LLONG_MAX #include <string.h>
#define %(ULONG_LONG_MAX)s PY_ULLONG_MAX
#else
#define PY_LONG_LONG LONG_LONG
#if defined(LLONG_MAX) void __pyx_init_nan(void);
#define %(LONG_LONG_MAX)s LLONG_MAX
#define %(ULONG_LONG_MAX)s ULLONG_MAX
#else
#define %(LONG_LONG_MAX)s LONG_MAX
#define %(ULONG_LONG_MAX)s ULONG_MAX
#endif
#endif
/* Define NAN */ static float %(PYX_NAN)s;
#ifdef Py_NAN """ % vars(Naming),
#define %(PYX_NAN)s Py_NAN
#elif defined(NAN) init="""
#define %(PYX_NAN)s NAN /* Initialize NaN. The sign is irrelevant, an exponent with all bits 1 and
#elif defined(HUGE_VALL) a nonzero mantissa means NaN. If the first bit in the mantissa is 1, it is
#define %(PYX_NAN)s HUGE_VALL a signalling NaN. */
#elif defined(__STDC__) && __STDC_VERSION__ >= 199901L memset(&%(PYX_NAN)s, 0xFF, sizeof(%(PYX_NAN)s));
/* C99 or greater */
#include <float.h>
#define %(PYX_NAN)s LDBL_MAX
#else
static PY_LONG_LONG __pyx__nan = %(LONG_LONG_MAX)s;
#define %(PYX_NAN)s (*(double*) &__pyx__nan)
#endif
""" % vars(Naming)) """ % vars(Naming))
...@@ -2370,11 +2370,11 @@ rank_to_type_name = ( ...@@ -2370,11 +2370,11 @@ rank_to_type_name = (
) )
typename_to_maxval = { typename_to_maxval = {
"char" : ("CHAR_MAX", "UCHAR_MAX"), "char" : ("'?'", "'?'"),
"short": ("SHRT_MAX", "USHRT_MAX"), "short": ("0xbad", "0xbad0"),
"int" : ("INT_MAX", "UINT_MAX"), "int" : ("0xbad", "0xbad0"),
"long" : ("LONG_MAX", "ULONG_MAX"), "long" : ("0xbad0bad", "0xbad0bad0"),
"PY_LONG_LONG" : (Naming.LONG_LONG_MAX, Naming.ULONG_LONG_MAX), "PY_LONG_LONG" : ("0xbad0bad0bad0bad", "0xbad0bad0bad0bad0"),
# CFloatType overrides invalid_value # CFloatType overrides invalid_value
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment