Skip to content

Commit

Permalink
pythongh-89640: Hardcode Emscripten float word ordering
Browse files Browse the repository at this point in the history
  • Loading branch information
erlend-aasland committed Nov 4, 2024
1 parent 0d80777 commit e85811c
Show file tree
Hide file tree
Showing 3 changed files with 40 additions and 53 deletions.
47 changes: 20 additions & 27 deletions configure

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

42 changes: 20 additions & 22 deletions configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -5946,28 +5946,26 @@ AS_VAR_IF([ac_cv_gcc_asm_for_x64], [yes], [
# * Check for various properties of floating point *
# **************************************************

AX_C_FLOAT_WORDS_BIGENDIAN
if test "$ax_cv_c_float_words_bigendian" = "yes"
then
AC_DEFINE([DOUBLE_IS_BIG_ENDIAN_IEEE754], [1],
[Define if C doubles are 64-bit IEEE 754 binary format, stored
with the most significant byte first])
elif test "$ax_cv_c_float_words_bigendian" = "no"
then
AC_DEFINE([DOUBLE_IS_LITTLE_ENDIAN_IEEE754], [1],
[Define if C doubles are 64-bit IEEE 754 binary format, stored
with the least significant byte first])
else
# Some ARM platforms use a mixed-endian representation for doubles.
# While Python doesn't currently have full support for these platforms
# (see e.g., issue 1762561), we can at least make sure that float <-> string
# conversions work.
# FLOAT_WORDS_BIGENDIAN doesn't actually detect this case, but if it's not big
# or little, then it must be this?
AC_DEFINE([DOUBLE_IS_ARM_MIXED_ENDIAN_IEEE754], [1],
[Define if C doubles are 64-bit IEEE 754 binary format, stored
in ARM mixed-endian order (byte order 45670123)])
fi
AX_C_FLOAT_WORDS_BIGENDIAN(
[AC_DEFINE([DOUBLE_IS_BIG_ENDIAN_IEEE754], [1],
[Define if C doubles are 64-bit IEEE 754 binary format,
stored with the most significant byte first])],
[AC_DEFINE([DOUBLE_IS_LITTLE_ENDIAN_IEEE754], [1],
[Define if C doubles are 64-bit IEEE 754 binary format,
stored with the least significant byte first])],
[AS_CASE([$host_cpu],
[*arm*], [# Some ARM platforms use a mixed-endian representation for
# doubles. While Python doesn't currently have full support
# for these platforms (see e.g., issue 1762561), we can at
# least make sure that float <-> string conversions work.
# FLOAT_WORDS_BIGENDIAN doesn't actually detect this case,
# but if it's not big or little, then it must be this?
AC_DEFINE([DOUBLE_IS_ARM_MIXED_ENDIAN_IEEE754], [1],
[Define if C doubles are 64-bit IEEE 754 binary format,
stored in ARM mixed-endian order (byte order 45670123)])],
[wasm*], [AC_DEFINE([DOUBLE_IS_LITTLE_ENDIAN_IEEE754], [1],
[Define if C doubles are 64-bit IEEE 754 binary format,
stored with the least significant byte first])])])

# The short float repr introduced in Python 3.1 requires the
# correctly-rounded string <-> double conversion functions from
Expand Down
4 changes: 0 additions & 4 deletions pyconfig.h.in
Original file line number Diff line number Diff line change
Expand Up @@ -47,10 +47,6 @@
/* Define if --enable-ipv6 is specified */
#undef ENABLE_IPV6

/* Define to 1 if your system stores words within floats with the most
significant word first */
#undef FLOAT_WORDS_BIGENDIAN

/* Define if getpgrp() must be called as getpgrp(0). */
#undef GETPGRP_HAVE_ARG

Expand Down

0 comments on commit e85811c

Please sign in to comment.