aboutsummaryrefslogtreecommitdiffstats
path: root/erts/emulator/beam/utils.c
diff options
context:
space:
mode:
authorBjörn-Egil Dahlberg <[email protected]>2015-05-07 16:50:52 +0200
committerBjörn-Egil Dahlberg <[email protected]>2015-05-07 16:50:52 +0200
commitb17d18510c013b5077c57e778b6e1bf0f8784395 (patch)
treeeb06ea1198cbfe62dc70943b0baad255912e5225 /erts/emulator/beam/utils.c
parent7b9a2c6b90cc6f41b0f42198e474a9322a4f2a94 (diff)
parent889dbf81def0986e4569841d64a7f3882808ee07 (diff)
downloadotp-b17d18510c013b5077c57e778b6e1bf0f8784395.tar.gz
otp-b17d18510c013b5077c57e778b6e1bf0f8784395.tar.bz2
otp-b17d18510c013b5077c57e778b6e1bf0f8784395.zip
Merge branch 'egil/fix-pos-zero-opt'
* egil/fix-pos-zero-opt: erts: Don't let the compiler optimize pos. zero fix
Diffstat (limited to 'erts/emulator/beam/utils.c')
-rw-r--r--erts/emulator/beam/utils.c12
1 files changed, 8 insertions, 4 deletions
diff --git a/erts/emulator/beam/utils.c b/erts/emulator/beam/utils.c
index 8f6335d5dd..51de3528be 100644
--- a/erts/emulator/beam/utils.c
+++ b/erts/emulator/beam/utils.c
@@ -958,7 +958,8 @@ tail_recur:
FloatDef ff;
GET_DOUBLE(term, ff);
if (ff.fd == 0.0f) {
- ff.fd = 0.0f; /* ensure pos. 0.0 */
+ /* ensure positive 0.0 */
+ ff.fd = erts_get_positive_zero_float();
}
hash = hash*FUNNY_NUMBER6 + (ff.fw[0] ^ ff.fw[1]);
break;
@@ -1477,7 +1478,8 @@ make_hash2(Eterm term)
FloatDef ff;
GET_DOUBLE(term, ff);
if (ff.fd == 0.0f) {
- ff.fd = 0.0f; /* ensure pos. 0.0 */
+ /* ensure positive 0.0 */
+ ff.fd = erts_get_positive_zero_float();
}
#if defined(WORDS_BIGENDIAN) || defined(DOUBLE_MIDDLE_ENDIAN)
UINT32_HASH_2(ff.fw[0], ff.fw[1], HCONST_12);
@@ -1899,7 +1901,8 @@ make_internal_hash(Eterm term)
FloatDef ff;
GET_DOUBLE(term, ff);
if (ff.fd == 0.0f) {
- ff.fd = 0.0f; /* ensure pos. 0.0 */
+ /* ensure positive 0.0 */
+ ff.fd = erts_get_positive_zero_float();
}
UINT32_HASH_2(ff.fw[0], ff.fw[1], HCONST_12);
goto pop_next;
@@ -2087,7 +2090,8 @@ tail_recur:
FloatDef ff;
GET_DOUBLE(term, ff);
if (ff.fd == 0.0f) {
- ff.fd = 0.0f; /* ensure pos. 0.0 */
+ /* ensure positive 0.0 */
+ ff.fd = erts_get_positive_zero_float();
}
hash = hash*FUNNY_NUMBER6 + (ff.fw[0] ^ ff.fw[1]);
}