diff options
author | Lars Hesel Christensen <[email protected]> | 2013-09-24 11:22:48 +0200 |
---|---|---|
committer | Fredrik Gustafsson <[email protected]> | 2013-10-10 14:28:39 +0200 |
commit | 54aecc2a73a1398d141c7f8e9a96c24a5a5731cf (patch) | |
tree | 9c0951d7fe2e1d69d5c707c6a6c72d608ccb1c3f /erts/emulator/beam | |
parent | 4364de3cc6c6212b291a5c240f25a00e90b2e852 (diff) | |
download | otp-54aecc2a73a1398d141c7f8e9a96c24a5a5731cf.tar.gz otp-54aecc2a73a1398d141c7f8e9a96c24a5a5731cf.tar.bz2 otp-54aecc2a73a1398d141c7f8e9a96c24a5a5731cf.zip |
Fix bsr bug
Fix bsr bug occurring when shifting a huge number a huge number of
bits to the right. The bug can occur if Sint is 64 bits and int is 32
bits, causing a truncation in the big.c:I_lshift function.
Diffstat (limited to 'erts/emulator/beam')
-rw-r--r-- | erts/emulator/beam/big.c | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/erts/emulator/beam/big.c b/erts/emulator/beam/big.c index 6b43c53985..2b27b111d8 100644 --- a/erts/emulator/beam/big.c +++ b/erts/emulator/beam/big.c @@ -1325,9 +1325,9 @@ static dsize_t I_lshift(ErtsDigit* x, dsize_t xl, Sint y, return 1; } else { - SWord ay = (y < 0) ? -y : y; - int bw = ay / D_EXP; - int sw = ay % D_EXP; + Uint ay = (y < 0) ? -y : y; + Uint bw = ay / D_EXP; + Uint sw = ay % D_EXP; dsize_t rl; ErtsDigit a1=0; ErtsDigit a0=0; @@ -1368,7 +1368,7 @@ static dsize_t I_lshift(ErtsDigit* x, dsize_t xl, Sint y, } if (sign) { - int zl = bw; + Uint zl = bw; ErtsDigit* z = x; while(zl--) { |