about summary refs log tree commit diff
path: root/iconv/gconv_simple.c
diff options
context:
space:
mode:
authorUlrich Drepper <drepper@redhat.com>2007-10-12 04:40:48 +0000
committerUlrich Drepper <drepper@redhat.com>2007-10-12 04:40:48 +0000
commit26a51060b10e284231ff73197957cbff52970159 (patch)
tree635f995f4624da2a38eff4255e11c981b4b1ff28 /iconv/gconv_simple.c
parent6dd3748b5dbe97cbcdbc56728452ae91bf3bdf44 (diff)
downloadglibc-26a51060b10e284231ff73197957cbff52970159.tar.gz
glibc-26a51060b10e284231ff73197957cbff52970159.tar.xz
glibc-26a51060b10e284231ff73197957cbff52970159.zip
* iconv/gconv_simple.c: Add some branch prediction.
Diffstat (limited to 'iconv/gconv_simple.c')
-rw-r--r--iconv/gconv_simple.c16
1 files changed, 7 insertions, 9 deletions
diff --git a/iconv/gconv_simple.c b/iconv/gconv_simple.c
index 343c27521f..ec8f38a962 100644
--- a/iconv/gconv_simple.c
+++ b/iconv/gconv_simple.c
@@ -1,5 +1,5 @@
 /* Simple transformations functions.
-   Copyright (C) 1997-2003, 2004, 2005 Free Software Foundation, Inc.
+   Copyright (C) 1997-2003, 2004, 2005, 2007 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997.
 
@@ -880,7 +880,7 @@ ucs4le_internal_loop_single (struct __gconv_step *step,
   {									      \
     uint32_t wc = *((const uint32_t *) inptr);				      \
 									      \
-    if (wc < 0x80)							      \
+    if (__builtin_expect (wc < 0x80, 1))				      \
       /* It's an one byte sequence.  */					      \
       *outptr++ = (unsigned char) wc;					      \
     else if (__builtin_expect (wc <= 0x7fffffff, 1))			      \
@@ -940,21 +940,19 @@ ucs4le_internal_loop_single (struct __gconv_step *step,
 #define LOOPFCT			FROM_LOOP
 #define BODY \
   {									      \
-    uint32_t ch;							      \
-    uint_fast32_t cnt;							      \
-    uint_fast32_t i;							      \
-									      \
     /* Next input byte.  */						      \
-    ch = *inptr;							      \
+    uint32_t ch = *inptr;						      \
 									      \
-    if (ch < 0x80)							      \
+    if (__builtin_expect (ch < 0x80, 1))				      \
       {									      \
 	/* One byte sequence.  */					      \
-	cnt = 1;							      \
 	++inptr;							      \
       }									      \
     else								      \
       {									      \
+	uint_fast32_t cnt;						      \
+	uint_fast32_t i;						      \
+									      \
 	if (ch >= 0xc2 && ch < 0xe0)					      \
 	  {								      \
 	    /* We expect two bytes.  The first byte cannot be 0xc0 or 0xc1,   \