* sysdeps/generic/strtol.c: Little optimizations.  Add some
	__builtin_expect.
This commit is contained in:
Ulrich Drepper 2001-08-19 03:52:42 +00:00
parent 668770fc51
commit 091b895531
2 changed files with 9 additions and 10 deletions

View File

@ -1,5 +1,8 @@
2001-08-18 Ulrich Drepper <drepper@redhat.com> 2001-08-18 Ulrich Drepper <drepper@redhat.com>
* sysdeps/generic/strtol.c: Little optimizations. Add some
__builtin_expect.
* conform/conformtest.pl: <inttypes.h> test required <stddef.h>. * conform/conformtest.pl: <inttypes.h> test required <stddef.h>.
* wcsmbs/wchar.h (wcwdith): Change parameter type to wchar_t. * wcsmbs/wchar.h (wcwdith): Change parameter type to wchar_t.

View File

@ -263,7 +263,7 @@ INTERNAL (strtol) (nptr, endptr, base, group LOCALE_PARAM)
in the format described in <locale.h>. */ in the format described in <locale.h>. */
const char *grouping; const char *grouping;
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)
@ -305,22 +305,18 @@ INTERNAL (strtol) (nptr, endptr, base, group LOCALE_PARAM)
/* Skip white space. */ /* Skip white space. */
while (ISSPACE (*s)) while (ISSPACE (*s))
++s; ++s;
if (*s == L_('\0')) if (__builtin_expect (*s == L_('\0'), 0))
goto noconv; goto noconv;
/* Check for a sign. */ /* Check for a sign. */
negative = 0;
if (*s == L_('-')) if (*s == L_('-'))
{ {
negative = 1; negative = 1;
++s; ++s;
} }
else if (*s == L_('+')) else if (*s == L_('+'))
{
negative = 0;
++s; ++s;
}
else
negative = 0;
/* Recognize number prefix and if BASE is zero, figure it out ourselves. */ /* Recognize number prefix and if BASE is zero, figure it out ourselves. */
if (*s == L_('0')) if (*s == L_('0'))
@ -343,7 +339,7 @@ INTERNAL (strtol) (nptr, endptr, base, group LOCALE_PARAM)
if (base != 10) if (base != 10)
grouping = NULL; grouping = NULL;
if (grouping) if (__builtin_expect (grouping != NULL, 0))
{ {
# ifndef USE_WIDE_CHAR # ifndef USE_WIDE_CHAR
thousands_len = strlen (thousands); thousands_len = strlen (thousands);
@ -506,7 +502,7 @@ INTERNAL (strtol) (nptr, endptr, base, group LOCALE_PARAM)
overflow = 1; overflow = 1;
#endif #endif
if (overflow) if (__builtin_expect (overflow, 0))
{ {
__set_errno (ERANGE); __set_errno (ERANGE);
#if UNSIGNED #if UNSIGNED