Skip to content

Commit b85f9d4

Browse files
committed
Optimize for clang.
1 parent 604bf0e commit b85f9d4

File tree

1 file changed

+16
-10
lines changed

1 file changed

+16
-10
lines changed

json_parser.c

Lines changed: 16 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -496,19 +496,25 @@ static int __parse_json_number(const char *cursor, const char **end,
496496
n = mant;
497497
if (exp != 0 && figures != 0)
498498
{
499-
if (exp > 291)
500-
n = INFINITY;
501-
else if (exp > 0)
502-
n *= __power_of_10[exp];
503-
else if (exp > -309)
504-
n /= __power_of_10[-exp];
505-
else if (exp > -324 - figures)
499+
if (exp > 0)
506500
{
507-
n /= __power_of_10[-exp - 308];
508-
n /= __power_of_10[308];
501+
if (exp > 291)
502+
n = INFINITY;
503+
else
504+
n *= __power_of_10[exp];
509505
}
510506
else
511-
n = 0.0;
507+
{
508+
if (exp > -309)
509+
n /= __power_of_10[-exp];
510+
else if (exp > -324 - figures)
511+
{
512+
n /= __power_of_10[-exp - 308];
513+
n /= __power_of_10[308];
514+
}
515+
else
516+
n = 0.0;
517+
}
512518
}
513519

514520
if (minus)

0 commit comments

Comments
 (0)