aboutsummaryrefslogtreecommitdiff
path: root/src/lj_strfmt_num.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/lj_strfmt_num.c')
-rw-r--r--src/lj_strfmt_num.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/src/lj_strfmt_num.c b/src/lj_strfmt_num.c
index 36b11dc0..8cb5d47f 100644
--- a/src/lj_strfmt_num.c
+++ b/src/lj_strfmt_num.c
@@ -257,7 +257,7 @@ static int nd_similar(uint32_t* nd, uint32_t ndhi, uint32_t* ref, MSize hilen,
257 } else { 257 } else {
258 prec -= hilen - 9; 258 prec -= hilen - 9;
259 } 259 }
260 lua_assert(prec < 9); 260 lj_assertX(prec < 9, "bad precision %d", prec);
261 lj_strfmt_wuint9(nd9, nd[ndhi]); 261 lj_strfmt_wuint9(nd9, nd[ndhi]);
262 lj_strfmt_wuint9(ref9, *ref); 262 lj_strfmt_wuint9(ref9, *ref);
263 return !memcmp(nd9, ref9, prec) && (nd9[prec] < '5') == (ref9[prec] < '5'); 263 return !memcmp(nd9, ref9, prec) && (nd9[prec] < '5') == (ref9[prec] < '5');
@@ -414,14 +414,14 @@ static char *lj_strfmt_wfnum(SBuf *sb, SFormat sf, lua_Number n, char *p)
414 ** Rescaling was performed, but this introduced some error, and might 414 ** Rescaling was performed, but this introduced some error, and might
415 ** have pushed us across a rounding boundary. We check whether this 415 ** have pushed us across a rounding boundary. We check whether this
416 ** error affected the result by introducing even more error (2ulp in 416 ** error affected the result by introducing even more error (2ulp in
417 ** either direction), and seeing whether a roundary boundary was 417 ** either direction), and seeing whether a rounding boundary was
418 ** crossed. Having already converted the -2ulp case, we save off its 418 ** crossed. Having already converted the -2ulp case, we save off its
419 ** most significant digits, convert the +2ulp case, and compare them. 419 ** most significant digits, convert the +2ulp case, and compare them.
420 */ 420 */
421 int32_t eidx = e + 70 + (ND_MUL2K_MAX_SHIFT < 29) 421 int32_t eidx = e + 70 + (ND_MUL2K_MAX_SHIFT < 29)
422 + (t.u32.lo >= 0xfffffffe && !(~t.u32.hi << 12)); 422 + (t.u32.lo >= 0xfffffffe && !(~t.u32.hi << 12));
423 const int8_t *m_e = four_ulp_m_e + eidx * 2; 423 const int8_t *m_e = four_ulp_m_e + eidx * 2;
424 lua_assert(0 <= eidx && eidx < 128); 424 lj_assertG_(G(sbufL(sb)), 0 <= eidx && eidx < 128, "bad eidx %d", eidx);
425 nd[33] = nd[ndhi]; 425 nd[33] = nd[ndhi];
426 nd[32] = nd[(ndhi - 1) & 0x3f]; 426 nd[32] = nd[(ndhi - 1) & 0x3f];
427 nd[31] = nd[(ndhi - 2) & 0x3f]; 427 nd[31] = nd[(ndhi - 2) & 0x3f];