* stdlib/strtod_l.c (____STRTOF_INTERNAL): Add branch predictions

and fix some typos.
	Optimize use of TOLOWER.
This commit is contained in:
Ulrich Drepper 2007-02-22 00:45:40 +00:00
parent 9cf147d84e
commit 621c133d40
2 changed files with 13 additions and 10 deletions

View File

@ -1,6 +1,8 @@
2007-02-21 Ulrich Drepper <drepper@redhat.com> 2007-02-21 Ulrich Drepper <drepper@redhat.com>
* stdlib/strtod_l.c (____STRTOF_INTERNAL): Optimize use of TOLOWER. * stdlib/strtod_l.c (____STRTOF_INTERNAL): Add branch predictions
and fix some typos.
Optimize use of TOLOWER.
[BZ #3325] [BZ #3325]
* sysdeps/i386/fpu/e_fmodf.S: Revert last changes, keep using fprem. * sysdeps/i386/fpu/e_fmodf.S: Revert last changes, keep using fprem.

View File

@ -482,7 +482,7 @@ ____STRTOF_INTERNAL (nptr, endptr, group, loc)
struct locale_data *current = loc->__locales[LC_NUMERIC]; struct locale_data *current = loc->__locales[LC_NUMERIC];
if (group) if (__builtin_expect (group, 0))
{ {
grouping = _NL_CURRENT (LC_NUMERIC, GROUPING); grouping = _NL_CURRENT (LC_NUMERIC, GROUPING);
if (*grouping <= 0 || *grouping == CHAR_MAX) if (*grouping <= 0 || *grouping == CHAR_MAX)
@ -548,7 +548,7 @@ ____STRTOF_INTERNAL (nptr, endptr, group, loc)
&& (wint_t) cp[1] >= L'0' && (wint_t) cp[1] <= L'9') && (wint_t) cp[1] >= L'0' && (wint_t) cp[1] <= L'9')
{ {
/* We accept it. This funny construct is here only to indent /* We accept it. This funny construct is here only to indent
the code directly. */ the code correctly. */
} }
#else #else
for (cnt = 0; decimal[cnt] != '\0'; ++cnt) for (cnt = 0; decimal[cnt] != '\0'; ++cnt)
@ -557,7 +557,7 @@ ____STRTOF_INTERNAL (nptr, endptr, group, loc)
if (decimal[cnt] == '\0' && cp[cnt] >= '0' && cp[cnt] <= '9') if (decimal[cnt] == '\0' && cp[cnt] >= '0' && cp[cnt] <= '9')
{ {
/* We accept it. This funny construct is here only to indent /* We accept it. This funny construct is here only to indent
the code directly. */ the code correctly. */
} }
#endif #endif
else if (c < L_('0') || c > L_('9')) else if (c < L_('0') || c > L_('9'))
@ -643,7 +643,7 @@ ____STRTOF_INTERNAL (nptr, endptr, group, loc)
while (c == L'0' || ((wint_t) thousands != L'\0' && c == (wint_t) thousands)) while (c == L'0' || ((wint_t) thousands != L'\0' && c == (wint_t) thousands))
c = *++cp; c = *++cp;
#else #else
if (thousands == NULL) if (__builtin_expect (thousands == NULL, 1))
while (c == '0') while (c == '0')
c = *++cp; c = *++cp;
else else
@ -717,11 +717,12 @@ ____STRTOF_INTERNAL (nptr, endptr, group, loc)
else else
{ {
#ifdef USE_WIDE_CHAR #ifdef USE_WIDE_CHAR
if ((wint_t) thousands == L'\0' || c != (wint_t) thousands) if (__builtin_expect ((wint_t) thousands == L'\0', 1)
|| c != (wint_t) thousands)
/* Not a digit or separator: end of the integer part. */ /* Not a digit or separator: end of the integer part. */
break; break;
#else #else
if (thousands == NULL) if (__builtin_expect (thousands == NULL, 1))
break; break;
else else
{ {
@ -737,7 +738,7 @@ ____STRTOF_INTERNAL (nptr, endptr, group, loc)
c = *++cp; c = *++cp;
} }
if (grouping && cp > start_of_digits) if (__builtin_expect (grouping != NULL, 0) && cp > start_of_digits)
{ {
/* Check the grouping of the digits. */ /* Check the grouping of the digits. */
#ifdef USE_WIDE_CHAR #ifdef USE_WIDE_CHAR
@ -846,7 +847,7 @@ ____STRTOF_INTERNAL (nptr, endptr, group, loc)
exponent *= 10; exponent *= 10;
exponent += c - L_('0'); exponent += c - L_('0');
if (exponent > exp_limit) if (__builtin_expect (exponent > exp_limit, 0))
/* The exponent is too large/small to represent a valid /* The exponent is too large/small to represent a valid
number. */ number. */
{ {
@ -1100,7 +1101,7 @@ ____STRTOF_INTERNAL (nptr, endptr, group, loc)
/* Now we know the exponent of the number in base two. /* Now we know the exponent of the number in base two.
Check it against the maximum possible exponent. */ Check it against the maximum possible exponent. */
if (bits > MAX_EXP) if (__builtin_expect (bits > MAX_EXP, 0))
{ {
__set_errno (ERANGE); __set_errno (ERANGE);
return negative ? -FLOAT_HUGE_VAL : FLOAT_HUGE_VAL; return negative ? -FLOAT_HUGE_VAL : FLOAT_HUGE_VAL;