diff options
Diffstat (limited to 'src')
| -rw-r--r-- | src/lj_strscan.c | 5 |
1 files changed, 2 insertions, 3 deletions
diff --git a/src/lj_strscan.c b/src/lj_strscan.c index f5f35c96..401798a0 100644 --- a/src/lj_strscan.c +++ b/src/lj_strscan.c | |||
| @@ -492,12 +492,11 @@ StrScanFmt lj_strscan_scan(const uint8_t *p, TValue *o, uint32_t opt) | |||
| 492 | /* Fast path for decimal 32 bit integers. */ | 492 | /* Fast path for decimal 32 bit integers. */ |
| 493 | if (fmt == STRSCAN_INT && base == 10 && | 493 | if (fmt == STRSCAN_INT && base == 10 && |
| 494 | (dig < 10 || (dig == 10 && *sp <= '2' && x < 0x80000000u+neg))) { | 494 | (dig < 10 || (dig == 10 && *sp <= '2' && x < 0x80000000u+neg))) { |
| 495 | int32_t y = neg ? -(int32_t)x : (int32_t)x; | ||
| 496 | if ((opt & STRSCAN_OPT_TONUM)) { | 495 | if ((opt & STRSCAN_OPT_TONUM)) { |
| 497 | o->n = (double)y; | 496 | o->n = neg ? -(double)x : (double)x; |
| 498 | return STRSCAN_NUM; | 497 | return STRSCAN_NUM; |
| 499 | } else { | 498 | } else { |
| 500 | o->i = y; | 499 | o->i = neg ? -(int32_t)x : (int32_t)x; |
| 501 | return STRSCAN_INT; | 500 | return STRSCAN_INT; |
| 502 | } | 501 | } |
| 503 | } | 502 | } |
