mirror of
https://github.com/jerryscript-project/jerryscript.git
synced 2025-12-15 16:29:21 +00:00
Parse integer numbers from back to front.
JerryScript-DCO-1.0-Signed-off-by: Dániel Bátyai dbatyai.u-szeged@partner.samsung.com
This commit is contained in:
parent
034ecf78f8
commit
91f0c9d625
@ -980,9 +980,10 @@ lexer_parse_number (void)
|
||||
const lit_utf8_byte_t *fp_buf_p = TOK_START ();
|
||||
/* token is constructed at end of function */
|
||||
|
||||
for (i = 0; i < tok_length; i++)
|
||||
ecma_number_t mult = 1.0f;
|
||||
for (i = tok_length; i > 0; i--, mult *= 10)
|
||||
{
|
||||
fp_res = fp_res * 10 + (ecma_number_t) lit_char_hex_to_int (fp_buf_p[i]);
|
||||
fp_res += (ecma_number_t) lit_char_hex_to_int (fp_buf_p[i - 1]) * mult;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -22,3 +22,5 @@ assert(big == 2147483648); // overflow on 32bit numbers
|
||||
|
||||
big++;
|
||||
assert(big == 2147483649); // overflow on 32bit numbers
|
||||
|
||||
assert ((1152921504606846900).toString() === "1152921504606847000")
|
||||
Loading…
x
Reference in New Issue
Block a user