[number] minor

This commit is contained in:
Ebrahim Byagowi 2020-05-11 15:56:54 +04:30
parent bb095e1bdd
commit 2cc78a58c3
2 changed files with 10 additions and 14 deletions

View File

@ -119,9 +119,8 @@ _pow10 (unsigned exponent)
/* a variant of strtod that also gets end of buffer in its second argument */
static inline double
strtod_rl (const char *buf, const char **end_ptr /* IN/OUT */)
strtod_rl (const char *p, const char **end_ptr /* IN/OUT */)
{
const char *p, *pe;
double value = 0;
double frac = 0;
double frac_count = 0;
@ -129,20 +128,19 @@ strtod_rl (const char *buf, const char **end_ptr /* IN/OUT */)
bool neg = false, exp_neg = false, exp_overflow = false;
const unsigned long long MAX_FRACT = 0xFFFFFFFFFFFFFull; /* 2^52-1 */
const unsigned MAX_EXP = 0x7FFu; /* 2^11-1 */
p = buf;
pe = *end_ptr;
const char *pe = *end_ptr;
while (p < pe && ISSPACE (*p))
p++;
int cs;
#line 141 "hb-number-parser.hh"
#line 139 "hb-number-parser.hh"
{
cs = double_parser_start;
}
#line 146 "hb-number-parser.hh"
#line 144 "hb-number-parser.hh"
{
int _slen;
int _trans;
@ -200,7 +198,7 @@ _resume:
exp_overflow = true;
}
break;
#line 204 "hb-number-parser.hh"
#line 202 "hb-number-parser.hh"
}
_again:
@ -212,10 +210,10 @@ _again:
_out: {}
}
#line 115 "hb-number-parser.rl"
#line 113 "hb-number-parser.rl"
*end_ptr = (const char *) p;
*end_ptr = p;
if (frac_count) value += frac / _pow10 (frac_count);
if (neg) value *= -1.;

View File

@ -92,9 +92,8 @@ _pow10 (unsigned exponent)
/* a variant of strtod that also gets end of buffer in its second argument */
static inline double
strtod_rl (const char *buf, const char **end_ptr /* IN/OUT */)
strtod_rl (const char *p, const char **end_ptr /* IN/OUT */)
{
const char *p, *pe;
double value = 0;
double frac = 0;
double frac_count = 0;
@ -102,9 +101,8 @@ strtod_rl (const char *buf, const char **end_ptr /* IN/OUT */)
bool neg = false, exp_neg = false, exp_overflow = false;
const unsigned long long MAX_FRACT = 0xFFFFFFFFFFFFFull; /* 2^52-1 */
const unsigned MAX_EXP = 0x7FFu; /* 2^11-1 */
p = buf;
pe = *end_ptr;
const char *pe = *end_ptr;
while (p < pe && ISSPACE (*p))
p++;
@ -114,7 +112,7 @@ strtod_rl (const char *buf, const char **end_ptr /* IN/OUT */)
write exec;
}%%
*end_ptr = (const char *) p;
*end_ptr = p;
if (frac_count) value += frac / _pow10 (frac_count);
if (neg) value *= -1.;