diff options
author | Johannes Weißl <[email protected]> | 2013-06-14 15:23:40 +0200 |
---|---|---|
committer | Johannes Weißl <[email protected]> | 2013-06-14 15:25:12 +0200 |
commit | 55d6274f67cafe62e4923a6369c99a45822cb767 (patch) | |
tree | 4256573feaf7b3698616e5b537a2460673fdaa71 /erts/emulator/beam/external.c | |
parent | 5dd13b1efead2a8101ff1fb46937fbfa00db5269 (diff) | |
download | otp-55d6274f67cafe62e4923a6369c99a45822cb767.tar.gz otp-55d6274f67cafe62e4923a6369c99a45822cb767.tar.bz2 otp-55d6274f67cafe62e4923a6369c99a45822cb767.zip |
Fix external term format BIFs on floating point middle-endian machines
This complements 933e701 (OTP-10209).
Simple error example:
1> <<131,70,63,240,0,0,0,0,0,0>> = term_to_binary(1.0, [{minor_version,1}]).
** exception error: no match of right hand side value <<131,70,0,0,0,0,63,240,0,0>>
2> 1.0 = binary_to_term(<<131,70,63,240,0,0,0,0,0,0>>).
** exception error: no match of right hand side value 5.299808824e-315
But roundtrip always works:
3> 1.0 = binary_to_term(term_to_binary(1.0, [{minor_version,1}])).
1.0
Diffstat (limited to 'erts/emulator/beam/external.c')
-rw-r--r-- | erts/emulator/beam/external.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/erts/emulator/beam/external.c b/erts/emulator/beam/external.c index 45025ad631..0d56de49c9 100644 --- a/erts/emulator/beam/external.c +++ b/erts/emulator/beam/external.c @@ -2316,7 +2316,7 @@ enc_term_int(Process *p,ErtsAtomCacheMap *acmp, Eterm obj, byte* ep, Uint32 dfla GET_DOUBLE(obj, f); if (dflags & DFLAG_NEW_FLOATS) { *ep++ = NEW_FLOAT_EXT; -#ifdef WORDS_BIGENDIAN +#if defined(WORDS_BIGENDIAN) || defined(DOUBLE_MIDDLE_ENDIAN) put_int32(f.fw[0], ep); ep += 4; put_int32(f.fw[1], ep); @@ -2795,7 +2795,7 @@ dec_term_atom_common: volatile unsigned long *fpexnp = erts_get_current_fp_exception(); #endif -#ifdef WORDS_BIGENDIAN +#if defined(WORDS_BIGENDIAN) || defined(DOUBLE_MIDDLE_ENDIAN) ff.fw[0] = get_int32(ep); ep += 4; ff.fw[1] = get_int32(ep); |