about summary refs log tree commit diff
path: root/sysdeps/generic
diff options
context:
space:
mode:
authorUlrich Drepper <drepper@redhat.com>2001-08-19 03:52:42 +0000
committerUlrich Drepper <drepper@redhat.com>2001-08-19 03:52:42 +0000
commit091b895531aabba1adc36ac6b68dd91ba52a0945 (patch)
tree3cbbd84af43c2f08b0e10809cf629ef0d874e575 /sysdeps/generic
parent668770fc51249efd4d063a02329b3fb353fa10e8 (diff)
downloadglibc-091b895531aabba1adc36ac6b68dd91ba52a0945.tar.gz
glibc-091b895531aabba1adc36ac6b68dd91ba52a0945.tar.xz
glibc-091b895531aabba1adc36ac6b68dd91ba52a0945.zip
Update.
	* sysdeps/generic/strtol.c: Little optimizations.  Add some
	__builtin_expect.
Diffstat (limited to 'sysdeps/generic')
-rw-r--r--sysdeps/generic/strtol.c16
1 files changed, 6 insertions, 10 deletions
diff --git a/sysdeps/generic/strtol.c b/sysdeps/generic/strtol.c
index 0f48b632eb..d2e09c8404 100644
--- a/sysdeps/generic/strtol.c
+++ b/sysdeps/generic/strtol.c
@@ -263,7 +263,7 @@ INTERNAL (strtol) (nptr, endptr, base, group LOCALE_PARAM)
      in the format described in <locale.h>.  */
   const char *grouping;
 
-  if (group)
+  if (__builtin_expect (group, 0))
     {
       grouping = _NL_CURRENT (LC_NUMERIC, GROUPING);
       if (*grouping <= 0 || *grouping == CHAR_MAX)
@@ -305,22 +305,18 @@ INTERNAL (strtol) (nptr, endptr, base, group LOCALE_PARAM)
   /* Skip white space.  */
   while (ISSPACE (*s))
     ++s;
-  if (*s == L_('\0'))
+  if (__builtin_expect (*s == L_('\0'), 0))
     goto noconv;
 
   /* Check for a sign.  */
+  negative = 0;
   if (*s == L_('-'))
     {
       negative = 1;
       ++s;
     }
   else if (*s == L_('+'))
-    {
-      negative = 0;
-      ++s;
-    }
-  else
-    negative = 0;
+    ++s;
 
   /* Recognize number prefix and if BASE is zero, figure it out ourselves.  */
   if (*s == L_('0'))
@@ -343,7 +339,7 @@ INTERNAL (strtol) (nptr, endptr, base, group LOCALE_PARAM)
   if (base != 10)
     grouping = NULL;
 
-  if (grouping)
+  if (__builtin_expect (grouping != NULL, 0))
     {
 # ifndef USE_WIDE_CHAR
       thousands_len = strlen (thousands);
@@ -506,7 +502,7 @@ INTERNAL (strtol) (nptr, endptr, base, group LOCALE_PARAM)
     overflow = 1;
 #endif
 
-  if (overflow)
+  if (__builtin_expect (overflow, 0))
     {
       __set_errno (ERANGE);
 #if UNSIGNED