From 89301d683e7401cb7cfcb6ebc89be6593d4c809f Mon Sep 17 00:00:00 2001 From: Ulrich Drepper Date: Tue, 6 Jun 2000 16:53:06 +0000 Subject: Update. 2000-06-06 Ulrich Drepper * 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. --- iconvdata/gbgbk.c | 21 +++++++++++++-------- 1 file changed, 13 insertions(+), 8 deletions(-) (limited to 'iconvdata/gbgbk.c') 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; \ -- cgit v1.2.3