From ebcb3df9b4423aead29365b677ca18b5bb868229 Mon Sep 17 00:00:00 2001 From: Indev Date: Mon, 3 Mar 2025 01:03:25 +0300 Subject: [PATCH] Revert "Convert parsed numbers to doubles first in lj_strscan_scan" This reverts commit 3f8fb365a0d0a99405a04eb3baa24a285c057700. --- src/bluajit/lj_strscan.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/bluajit/lj_strscan.c b/src/bluajit/lj_strscan.c index 334086768..1bc8a79fe 100644 --- a/src/bluajit/lj_strscan.c +++ b/src/bluajit/lj_strscan.c @@ -442,8 +442,7 @@ StrScanFmt lj_strscan_scan(const uint8_t *p, MSize len, TValue *o, int cmask = LJ_CHAR_DIGIT; int base = (opt & STRSCAN_OPT_C) && *p == '0' ? 0 : 10; const uint8_t *sp, *dp = NULL; - uint32_t dig = 0, hasdig = 0; - uint64_t x = 0; + uint32_t dig = 0, hasdig = 0, x = 0; int32_t ex = 0; /* Determine base and skip leading zeros. */ @@ -575,7 +574,10 @@ StrScanFmt lj_strscan_scan(const uint8_t *p, MSize len, TValue *o, fmt = strscan_bin(sp, o, fmt, opt, ex, neg, dig); else #if LJ_INTONLY - setintV(o, (int32_t)(double)(neg ? (~x+1u) : x)); + if (fmt == STRSCAN_NUM) + setnumV(o, (lua_Number)(int32_t)(neg ? ~x+1u : x)); + else + setintV(o, (int32_t)(neg ? ~x+1u : x)); #else fmt = strscan_dec(sp, o, fmt, opt, ex, neg, dig); #endif