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/euc-kr.c | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) (limited to 'iconvdata/euc-kr.c') diff --git a/iconvdata/euc-kr.c b/iconvdata/euc-kr.c index d84e72c..48fdee3 100644 --- a/iconvdata/euc-kr.c +++ b/iconvdata/euc-kr.c @@ -28,7 +28,8 @@ euckr_from_ucs4 (uint32_t ch, unsigned char *cp) { if (ch > 0x7f) { - if (ucs4_to_ksc5601 (ch, cp, 2) != __UNKNOWN_10646_CHAR) + if (__builtin_expect (ucs4_to_ksc5601 (ch, cp, 2), 0) + != __UNKNOWN_10646_CHAR) { cp[0] |= 0x80; cp[1] |= 0x80; @@ -78,7 +79,9 @@ euckr_from_ucs4 (uint32_t ch, unsigned char *cp) ++inptr; \ /* 0xfe(->0x7e : row 94) and 0xc9(->0x59 : row 41) are \ user-defined areas. */ \ - else if (ch <= 0xa0 || ch > 0xfe || ch == 0xc9) \ + else if (__builtin_expect (ch, 0xa1) <= 0xa0 \ + || __builtin_expect (ch, 0xa1) > 0xfe \ + || __builtin_expect (ch, 0xa1) == 0xc9) \ { \ /* This is illegal. */ \ if (! ignore_errors_p ()) \ @@ -97,13 +100,13 @@ euckr_from_ucs4 (uint32_t ch, unsigned char *cp) is also available. */ \ ch = ksc5601_to_ucs4 (&inptr, \ NEED_LENGTH_TEST ? inptr - inend : 2, 0x80); \ - if (NEED_LENGTH_TEST && ch == 0) \ + if (NEED_LENGTH_TEST && __builtin_expect (ch, 1) == 0) \ { \ /* The second character is not available. */ \ result = __GCONV_INCOMPLETE_INPUT; \ break; \ } \ - if (ch == __UNKNOWN_10646_CHAR) \ + if (__builtin_expect (ch, 0) == __UNKNOWN_10646_CHAR) \ { \ /* This is an illegal character. */ \ if (! ignore_errors_p ()) \ @@ -139,7 +142,7 @@ euckr_from_ucs4 (uint32_t ch, unsigned char *cp) Jamos should be considered either here or in euckr_from_ucs4() */ \ euckr_from_ucs4 (ch, cp) ; \ \ - if (cp[0] == '\0' && ch != 0) \ + if (__builtin_expect (cp[0], '\1') == '\0' && ch != 0) \ { \ /* Illegal character. */ \ if (! ignore_errors_p ()) \ @@ -157,7 +160,7 @@ euckr_from_ucs4 (uint32_t ch, unsigned char *cp) /* Now test for a possible second byte and write this if possible. */ \ if (cp[1] != '\0') \ { \ - if (NEED_LENGTH_TEST && outptr >= outend) \ + if (NEED_LENGTH_TEST && __builtin_expect (outptr >= outend, 0)) \ { \ /* The result does not fit into the buffer. */ \ --outptr; \ -- cgit v1.1