Skip to content

Commit

Permalink
gh-89640: Hardcode WASM float word ordering as little endian (#126387)
Browse files Browse the repository at this point in the history
  • Loading branch information
erlend-aasland authored Nov 4, 2024
1 parent 9b7294c commit 532fc08
Show file tree
Hide file tree
Showing 4 changed files with 41 additions and 53 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Hard-code float word ordering as little endian on WASM.
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 532fc08

Please sign in to comment.