[number] minor
This commit is contained in:
parent
bb095e1bdd
commit
2cc78a58c3
|
@ -119,9 +119,8 @@ _pow10 (unsigned exponent)
|
||||||
|
|
||||||
/* a variant of strtod that also gets end of buffer in its second argument */
|
/* a variant of strtod that also gets end of buffer in its second argument */
|
||||||
static inline double
|
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 value = 0;
|
||||||
double frac = 0;
|
double frac = 0;
|
||||||
double frac_count = 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;
|
bool neg = false, exp_neg = false, exp_overflow = false;
|
||||||
const unsigned long long MAX_FRACT = 0xFFFFFFFFFFFFFull; /* 2^52-1 */
|
const unsigned long long MAX_FRACT = 0xFFFFFFFFFFFFFull; /* 2^52-1 */
|
||||||
const unsigned MAX_EXP = 0x7FFu; /* 2^11-1 */
|
const unsigned MAX_EXP = 0x7FFu; /* 2^11-1 */
|
||||||
p = buf;
|
|
||||||
pe = *end_ptr;
|
|
||||||
|
|
||||||
|
const char *pe = *end_ptr;
|
||||||
while (p < pe && ISSPACE (*p))
|
while (p < pe && ISSPACE (*p))
|
||||||
p++;
|
p++;
|
||||||
|
|
||||||
int cs;
|
int cs;
|
||||||
|
|
||||||
#line 141 "hb-number-parser.hh"
|
#line 139 "hb-number-parser.hh"
|
||||||
{
|
{
|
||||||
cs = double_parser_start;
|
cs = double_parser_start;
|
||||||
}
|
}
|
||||||
|
|
||||||
#line 146 "hb-number-parser.hh"
|
#line 144 "hb-number-parser.hh"
|
||||||
{
|
{
|
||||||
int _slen;
|
int _slen;
|
||||||
int _trans;
|
int _trans;
|
||||||
|
@ -200,7 +198,7 @@ _resume:
|
||||||
exp_overflow = true;
|
exp_overflow = true;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
#line 204 "hb-number-parser.hh"
|
#line 202 "hb-number-parser.hh"
|
||||||
}
|
}
|
||||||
|
|
||||||
_again:
|
_again:
|
||||||
|
@ -212,10 +210,10 @@ _again:
|
||||||
_out: {}
|
_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 (frac_count) value += frac / _pow10 (frac_count);
|
||||||
if (neg) value *= -1.;
|
if (neg) value *= -1.;
|
||||||
|
|
|
@ -92,9 +92,8 @@ _pow10 (unsigned exponent)
|
||||||
|
|
||||||
/* a variant of strtod that also gets end of buffer in its second argument */
|
/* a variant of strtod that also gets end of buffer in its second argument */
|
||||||
static inline double
|
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 value = 0;
|
||||||
double frac = 0;
|
double frac = 0;
|
||||||
double frac_count = 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;
|
bool neg = false, exp_neg = false, exp_overflow = false;
|
||||||
const unsigned long long MAX_FRACT = 0xFFFFFFFFFFFFFull; /* 2^52-1 */
|
const unsigned long long MAX_FRACT = 0xFFFFFFFFFFFFFull; /* 2^52-1 */
|
||||||
const unsigned MAX_EXP = 0x7FFu; /* 2^11-1 */
|
const unsigned MAX_EXP = 0x7FFu; /* 2^11-1 */
|
||||||
p = buf;
|
|
||||||
pe = *end_ptr;
|
|
||||||
|
|
||||||
|
const char *pe = *end_ptr;
|
||||||
while (p < pe && ISSPACE (*p))
|
while (p < pe && ISSPACE (*p))
|
||||||
p++;
|
p++;
|
||||||
|
|
||||||
|
@ -114,7 +112,7 @@ strtod_rl (const char *buf, const char **end_ptr /* IN/OUT */)
|
||||||
write exec;
|
write exec;
|
||||||
}%%
|
}%%
|
||||||
|
|
||||||
*end_ptr = (const char *) p;
|
*end_ptr = p;
|
||||||
|
|
||||||
if (frac_count) value += frac / _pow10 (frac_count);
|
if (frac_count) value += frac / _pow10 (frac_count);
|
||||||
if (neg) value *= -1.;
|
if (neg) value *= -1.;
|
||||||
|
|
Loading…
Reference in New Issue