diff options
Diffstat (limited to 'src/lj_strscan.c')
-rw-r--r-- | src/lj_strscan.c | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/src/lj_strscan.c b/src/lj_strscan.c index 433b33a3..0e37a4f6 100644 --- a/src/lj_strscan.c +++ b/src/lj_strscan.c | |||
@@ -93,7 +93,7 @@ static void strscan_double(uint64_t x, TValue *o, int32_t ex2, int32_t neg) | |||
93 | } | 93 | } |
94 | 94 | ||
95 | /* Convert to double using a signed int64_t conversion, then rescale. */ | 95 | /* Convert to double using a signed int64_t conversion, then rescale. */ |
96 | lua_assert((int64_t)x >= 0); | 96 | lj_assertX((int64_t)x >= 0, "bad double conversion"); |
97 | n = (double)(int64_t)x; | 97 | n = (double)(int64_t)x; |
98 | if (neg) n = -n; | 98 | if (neg) n = -n; |
99 | if (ex2) n = ldexp(n, ex2); | 99 | if (ex2) n = ldexp(n, ex2); |
@@ -262,7 +262,7 @@ static StrScanFmt strscan_dec(const uint8_t *p, TValue *o, | |||
262 | uint32_t hi = 0, lo = (uint32_t)(xip-xi); | 262 | uint32_t hi = 0, lo = (uint32_t)(xip-xi); |
263 | int32_t ex2 = 0, idig = (int32_t)lo + (ex10 >> 1); | 263 | int32_t ex2 = 0, idig = (int32_t)lo + (ex10 >> 1); |
264 | 264 | ||
265 | lua_assert(lo > 0 && (ex10 & 1) == 0); | 265 | lj_assertX(lo > 0 && (ex10 & 1) == 0, "bad lo %d ex10 %d", lo, ex10); |
266 | 266 | ||
267 | /* Handle simple overflow/underflow. */ | 267 | /* Handle simple overflow/underflow. */ |
268 | if (idig > 310/2) { if (neg) setminfV(o); else setpinfV(o); return fmt; } | 268 | if (idig > 310/2) { if (neg) setminfV(o); else setpinfV(o); return fmt; } |
@@ -528,7 +528,7 @@ int LJ_FASTCALL lj_strscan_num(GCstr *str, TValue *o) | |||
528 | { | 528 | { |
529 | StrScanFmt fmt = lj_strscan_scan((const uint8_t *)strdata(str), str->len, o, | 529 | StrScanFmt fmt = lj_strscan_scan((const uint8_t *)strdata(str), str->len, o, |
530 | STRSCAN_OPT_TONUM); | 530 | STRSCAN_OPT_TONUM); |
531 | lua_assert(fmt == STRSCAN_ERROR || fmt == STRSCAN_NUM); | 531 | lj_assertX(fmt == STRSCAN_ERROR || fmt == STRSCAN_NUM, "bad scan format"); |
532 | return (fmt != STRSCAN_ERROR); | 532 | return (fmt != STRSCAN_ERROR); |
533 | } | 533 | } |
534 | 534 | ||
@@ -537,7 +537,8 @@ int LJ_FASTCALL lj_strscan_number(GCstr *str, TValue *o) | |||
537 | { | 537 | { |
538 | StrScanFmt fmt = lj_strscan_scan((const uint8_t *)strdata(str), str->len, o, | 538 | StrScanFmt fmt = lj_strscan_scan((const uint8_t *)strdata(str), str->len, o, |
539 | STRSCAN_OPT_TOINT); | 539 | STRSCAN_OPT_TOINT); |
540 | lua_assert(fmt == STRSCAN_ERROR || fmt == STRSCAN_NUM || fmt == STRSCAN_INT); | 540 | lj_assertX(fmt == STRSCAN_ERROR || fmt == STRSCAN_NUM || fmt == STRSCAN_INT, |
541 | "bad scan format"); | ||
541 | if (fmt == STRSCAN_INT) setitype(o, LJ_TISNUM); | 542 | if (fmt == STRSCAN_INT) setitype(o, LJ_TISNUM); |
542 | return (fmt != STRSCAN_ERROR); | 543 | return (fmt != STRSCAN_ERROR); |
543 | } | 544 | } |