Optimize a few expressions.
authordrepper <drepper>
Fri, 11 Sep 1998 12:14:15 +0000 (12:14 +0000)
committerdrepper <drepper>
Fri, 11 Sep 1998 12:14:15 +0000 (12:14 +0000)
string/strcoll.c
string/strxfrm.c

index f44f6c1..1aab47e 100644 (file)
@@ -172,31 +172,28 @@ STRCOLL (s1, s2, l)
            return w1 < w2 ? -1 : 1;
 
          /* We have to increment the index counters.  */
-         if ((forward && ++s1idx >= s1run->data[pass].number)
-             || (!forward && --s1idx < 0))
+         if (forward)
            {
-             if (forward)
+             if (++s1idx >= s1run->data[pass].number)
                {
                  s1run = s1run->next;
                  s1idx = 0;
                }
-             else
+             if (++s2idx >= s2run->data[pass].number)
                {
-                 s1run = s1run->prev;
-                 if (s1run != NULL)
-                   s1idx = s1run->data[pass].number - 1;
+                 s2run = s2run->next;
+                 s2idx = 0;
                }
            }
-
-         if ((forward && ++s2idx >= s2run->data[pass].number)
-             || (!forward && --s2idx < 0))
+         else
            {
-             if (forward)
+             if (--s1idx < 0)
                {
-                 s2run = s2run->next;
-                 s2idx = 0;
+                 s1run = s1run->prev;
+                 if (s1run != NULL)
+                   s1idx = s1run->data[pass].number - 1;
                }
-             else
+             if (--s2idx < 0)
                {
                  s2run = s2run->prev;
                  if (s2run != NULL)
index 0bdf106..c2b8f48 100644 (file)
@@ -249,15 +249,17 @@ STRXFRM (STRING_TYPE *dest, const STRING_TYPE *src, size_t n, __locale_t l)
            written = print_val (w, dest, n, written);
 
          /* We have to increment the index counters.  */
-         if ((forward && ++idx >= run->data[pass].number)
-             || (!forward && --idx < 0))
+         if (forward)
            {
-             if (forward)
+             if (++idx >= run->data[pass].number)
                {
                  run = run->next;
                  idx = 0;
                }
-             else
+           }
+         else
+           {
+             if (--idx < 0)
                {
                  run = run->prev;
                  if (run != NULL)