Skip to content

Commit 532fc08

Browse files
gh-89640: Hardcode WASM float word ordering as little endian (#126387)
1 parent 9b7294c commit 532fc08

File tree

4 files changed

+41
-53
lines changed

4 files changed

+41
-53
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Hard-code float word ordering as little endian on WASM.

configure

+20-27
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

configure.ac

+20-22
Original file line numberDiff line numberDiff line change
@@ -5946,28 +5946,26 @@ AS_VAR_IF([ac_cv_gcc_asm_for_x64], [yes], [
59465946
# * Check for various properties of floating point *
59475947
# **************************************************
59485948

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

59725970
# The short float repr introduced in Python 3.1 requires the
59735971
# correctly-rounded string <-> double conversion functions from

pyconfig.h.in

-4
Original file line numberDiff line numberDiff line change
@@ -47,10 +47,6 @@
4747
/* Define if --enable-ipv6 is specified */
4848
#undef ENABLE_IPV6
4949

50-
/* Define to 1 if your system stores words within floats with the most
51-
significant word first */
52-
#undef FLOAT_WORDS_BIGENDIAN
53-
5450
/* Define if getpgrp() must be called as getpgrp(0). */
5551
#undef GETPGRP_HAVE_ARG
5652

0 commit comments

Comments
 (0)