about summary refs log tree commit diff
path: root/iconvdata/gbgbk.c
diff options
context:
space:
mode:
authorUlrich Drepper <drepper@redhat.com>2000-06-06 16:53:06 +0000
committerUlrich Drepper <drepper@redhat.com>2000-06-06 16:53:06 +0000
commit89301d683e7401cb7cfcb6ebc89be6593d4c809f (patch)
tree5fcc96e30f608b81ac5a5cee239b6f4327f0a339 /iconvdata/gbgbk.c
parent5ea1a82defd37feaa6be1faf44854364c901cdaf (diff)
downloadglibc-89301d683e7401cb7cfcb6ebc89be6593d4c809f.tar.gz
glibc-89301d683e7401cb7cfcb6ebc89be6593d4c809f.tar.xz
glibc-89301d683e7401cb7cfcb6ebc89be6593d4c809f.zip
Update.
2000-06-06  Ulrich Drepper  <drepper@redhat.com>

	* iconvdata/iso-2022-kr.c: Add __builtin_expect in many places.
	* iconvdata/iso-2022-jp.c: Likewise.
	* iconvdata/iso-2022-cn.c: Likewise.
	* iconvdata/gbgbk.c: Likewise.
	* iconvdata/gbk.c: Likewise.
	* iconvdata/euc-kr.c: Likewise.
	* iconvdata/euc-jp.c: Likewise.
	* iconvdata/euc-cn.c: Likewise.
Diffstat (limited to 'iconvdata/gbgbk.c')
-rw-r--r--iconvdata/gbgbk.c21
1 files changed, 13 insertions, 8 deletions
diff --git a/iconvdata/gbgbk.c b/iconvdata/gbgbk.c
index 88617ae6c0..9a3e385cba 100644
--- a/iconvdata/gbgbk.c
+++ b/iconvdata/gbgbk.c
@@ -71,7 +71,7 @@
 		UCS4 -> GB2312 -> GBK -> UCS4				      \
 									      \
 	   might not produce identical text.  */			      \
-	if (NEED_LENGTH_TEST && inptr + 1 >= inend)			      \
+	if (NEED_LENGTH_TEST && __builtin_expect (inptr + 1 >= inend, 0))     \
 	  {								      \
 	    /* The second character is not available.  Store		      \
 	       the intermediate result.  */				      \
@@ -79,7 +79,7 @@
 	    break;							      \
 	  }								      \
 									      \
-	if (NEED_LENGTH_TEST && outend - outptr < 2)			      \
+	if (NEED_LENGTH_TEST && __builtin_expect (outend - outptr < 2, 0))    \
 	  {								      \
 	    /* We ran out of space.  */					      \
 	    result = __GCONV_FULL_OUTPUT;				      \
@@ -89,11 +89,16 @@
 	ch = (ch << 8) | inptr[1];					      \
 									      \
 	/* Now determine whether the character is valid.  */		      \
-	if (ch < 0xa1a1 || ch > 0xf7fe || inptr[1] < 0xa1		      \
+	if (__builtin_expect (ch, 0xa1a1) < 0xa1a1			      \
+	    || __builtin_expect (ch, 0xa1a1) > 0xf7fe			      \
+	    || __builtin_expect (inptr[1], 0xa1) < 0xa1			      \
 	    /* Now test the exceptions.  */				      \
-	    || (ch >= 0xa2a1 && ch <= 0xa2aa)				      \
-	    || (ch >= 0xa6e0 && ch <= 0xa6f5)				      \
-	    || (ch >= 0xa8bb && ch <= 0xa8c0))				      \
+	    || (__builtin_expect (ch, 0xa1a1) >= 0xa2a1			      \
+		&& __builtin_expect (ch, 0xa1a1) <= 0xa2aa)		      \
+	    || (__builtin_expect (ch, 0xa1a1) >= 0xa6e0			      \
+		&& __builtin_expect (ch, 0xa1a1) <= 0xa6f5)		      \
+	    || (__builtin_expect (ch, 0xa1a1) >= 0xa8bb			      \
+		&& __builtin_expect (ch, 0xa1a1) <= 0xa8c0))		      \
 	  {								      \
 	    /* One of the characters we cannot map.  */			      \
 	    if (! ignore_errors_p ())					      \
@@ -131,7 +136,7 @@
 									      \
     if (ch > 0x7f)							      \
       {									      \
-	if (NEED_LENGTH_TEST && inptr + 1 >= inend)			      \
+	if (NEED_LENGTH_TEST && __builtin_expect (inptr + 1 >= inend, 0))     \
 	  {								      \
 	    /* The second character is not available.  Store		      \
 		 the intermediate result.  */				      \
@@ -139,7 +144,7 @@
 	    break;							      \
 	  }								      \
 									      \
-	if (NEED_LENGTH_TEST && outend - outptr < 2)			      \
+	if (NEED_LENGTH_TEST && __builtin_expect (outend - outptr < 2, 0))    \
 	  {								      \
 	    /* We ran out of space.  */					      \
 	    result = __GCONV_FULL_OUTPUT;				      \