aboutsummaryrefslogtreecommitdiffstats
path: root/erts/emulator/beam/bif.c
diff options
context:
space:
mode:
authorIngela Anderton Andin <[email protected]>2014-11-13 14:17:26 +0100
committerIngela Anderton Andin <[email protected]>2014-11-13 14:17:26 +0100
commit7cf7cad70ec2b10a46b1f1c01a1d609467918492 (patch)
tree49943be69110215a353b8a0c2f68b47098d93ee1 /erts/emulator/beam/bif.c
parent509163307c31bf4f98a638b47ee03a5b99eb2c73 (diff)
parente61f384adff0c9b134750ee239581296d25c10cd (diff)
downloadotp-7cf7cad70ec2b10a46b1f1c01a1d609467918492.tar.gz
otp-7cf7cad70ec2b10a46b1f1c01a1d609467918492.tar.bz2
otp-7cf7cad70ec2b10a46b1f1c01a1d609467918492.zip
Merge branch 'maint' of git-server:otp into maint
Diffstat (limited to 'erts/emulator/beam/bif.c')
-rw-r--r--erts/emulator/beam/bif.c8
1 files changed, 5 insertions, 3 deletions
diff --git a/erts/emulator/beam/bif.c b/erts/emulator/beam/bif.c
index a5be8e1529..42dd160e38 100644
--- a/erts/emulator/beam/bif.c
+++ b/erts/emulator/beam/bif.c
@@ -2772,6 +2772,7 @@ static int do_list_to_integer(Process *p, Eterm orig_list,
Eterm *integer, Eterm *rest)
{
Sint i = 0;
+ Uint ui = 0;
int skip = 0;
int neg = 0;
int n = 0;
@@ -2825,8 +2826,8 @@ static int do_list_to_integer(Process *p, Eterm orig_list,
unsigned_val(CAR(list_val(lst))) > '9') {
break;
}
- i = i * 10;
- i = i + unsigned_val(CAR(list_val(lst))) - '0';
+ ui = ui * 10;
+ ui = ui + unsigned_val(CAR(list_val(lst))) - '0';
n++;
lst = CDR(list_val(lst));
if (is_nil(lst)) {
@@ -2850,7 +2851,8 @@ static int do_list_to_integer(Process *p, Eterm orig_list,
*/
if (n <= SMALL_DIGITS) { /* It must be small */
- if (neg) i = -i;
+ if (neg) i = -(Sint)ui;
+ else i = (Sint)ui;
res = make_small(i);
} else {
lg2 = (n+1)*230/69+1;