aboutsummaryrefslogtreecommitdiffstats
path: root/erts/emulator/beam/big.c
diff options
context:
space:
mode:
authorLukas Larsson <[email protected]>2014-08-14 09:43:04 +0200
committerLukas Larsson <[email protected]>2014-08-14 09:43:04 +0200
commit8fe6c462ec8e20ab2ad14b0c1addf1030ada0e54 (patch)
tree84b846c45bb63029cbd725e19ee3ab0274b21056 /erts/emulator/beam/big.c
parent9170441003f193e8b3f3a83e5ac51305e09e0f8c (diff)
parenta8cbf025f6e20a68b6575747200be149c6c09932 (diff)
downloadotp-8fe6c462ec8e20ab2ad14b0c1addf1030ada0e54.tar.gz
otp-8fe6c462ec8e20ab2ad14b0c1addf1030ada0e54.tar.bz2
otp-8fe6c462ec8e20ab2ad14b0c1addf1030ada0e54.zip
Merge branch 'nox/clang-ubsan/OTP-12097' into maint
* nox/clang-ubsan/OTP-12097: Properly handle SINT_MIN in small_to_big() Use offsetof() in io.c
Diffstat (limited to 'erts/emulator/beam/big.c')
-rw-r--r--erts/emulator/beam/big.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/erts/emulator/beam/big.c b/erts/emulator/beam/big.c
index 41a041eba6..4d087bf967 100644
--- a/erts/emulator/beam/big.c
+++ b/erts/emulator/beam/big.c
@@ -1506,13 +1506,15 @@ Eterm uword_to_big(UWord x, Eterm *y)
*/
Eterm small_to_big(Sint x, Eterm *y)
{
+ Uint xu;
if (x >= 0) {
+ xu = x;
*y = make_pos_bignum_header(1);
} else {
- x = -x;
+ xu = -(Uint)x;
*y = make_neg_bignum_header(1);
}
- BIG_DIGIT(y, 0) = x;
+ BIG_DIGIT(y, 0) = xu;
return make_big(y);
}