aboutsummaryrefslogtreecommitdiff
path: root/iconvdata/iso_6937.c
diff options
context:
space:
mode:
authorUlrich Drepper <drepper@redhat.com>2000-06-06 21:35:37 +0000
committerUlrich Drepper <drepper@redhat.com>2000-06-06 21:35:37 +0000
commit019357d23488c773cdef1dd077cc8915b6012d52 (patch)
tree021878c36d49a58618f2e094d656c22555d0bf83 /iconvdata/iso_6937.c
parent9b6a9cee8900c4f9c43ca5f2c9e62c589c4cf238 (diff)
downloadglibc-019357d23488c773cdef1dd077cc8915b6012d52.zip
glibc-019357d23488c773cdef1dd077cc8915b6012d52.tar.gz
glibc-019357d23488c773cdef1dd077cc8915b6012d52.tar.bz2
Add __builtin_expect in many places.
Diffstat (limited to 'iconvdata/iso_6937.c')
-rw-r--r--iconvdata/iso_6937.c24
1 files changed, 13 insertions, 11 deletions
diff --git a/iconvdata/iso_6937.c b/iconvdata/iso_6937.c
index f6581cf..391adf9 100644
--- a/iconvdata/iso_6937.c
+++ b/iconvdata/iso_6937.c
@@ -377,8 +377,8 @@ static const char from_ucs4[][2] =
#define TO_LOOP to_iso6937
#define DEFINE_INIT 1
#define DEFINE_FINI 1
-#define MIN_NEEDED_FROM 1
-#define MAX_NEEDED_FROM 2
+#define MIN_NEEDED_FROM 1
+#define MAX_NEEDED_FROM 2
#define MIN_NEEDED_TO 4
@@ -391,13 +391,13 @@ static const char from_ucs4[][2] =
{ \
uint32_t ch = *inptr; \
\
- if (ch >= 0xc1 && ch <= 0xcf) \
+ if (__builtin_expect (ch, 0) >= 0xc1 && ch <= 0xcf) \
{ \
/* Composed character. First test whether the next character \
is also available. */ \
int ch2; \
\
- if (inptr + 1 >= inend) \
+ if (NEED_LENGTH_TEST && __builtin_expect (inptr + 1 >= inend, 0)) \
{ \
/* The second character is not available. Store the \
intermediate result. */ \
@@ -407,7 +407,8 @@ static const char from_ucs4[][2] =
\
ch2 = inptr[1]; \
\
- if (ch2 < 0x20 || ch2 >= 0x80) \
+ if (__builtin_expect (ch2, 0) < 0x20 \
+ || __builtin_expect (ch2, 0) >= 0x80) \
{ \
/* This is illegal. */ \
if (! ignore_errors_p ()) \
@@ -424,7 +425,7 @@ static const char from_ucs4[][2] =
\
ch = to_ucs4_comb[ch - 0xc1][ch2 - 0x20]; \
\
- if (ch == 0) \
+ if (__builtin_expect (ch, 1) == 0) \
{ \
/* Illegal character. */ \
if (! ignore_errors_p ()) \
@@ -445,7 +446,7 @@ static const char from_ucs4[][2] =
{ \
ch = to_ucs4[ch]; \
\
- if (ch == 0 && *inptr != '\0') \
+ if (__builtin_expect (ch, 1) == 0 && *inptr != '\0') \
{ \
/* This is an illegal character. */ \
if (! ignore_errors_p ()) \
@@ -479,7 +480,8 @@ static const char from_ucs4[][2] =
uint32_t ch = get32 (inptr); \
const char *cp; \
\
- if (ch >= sizeof (from_ucs4) / sizeof (from_ucs4[0])) \
+ if (__builtin_expect (ch, 0) \
+ >= sizeof (from_ucs4) / sizeof (from_ucs4[0])) \
{ \
int fail = 0; \
switch (ch) \
@@ -535,7 +537,7 @@ static const char from_ucs4[][2] =
fail = 1; \
} \
\
- if (fail) \
+ if (__builtin_expect (fail, 0)) \
{ \
/* Illegal characters. */ \
if (! ignore_errors_p ()) \
@@ -550,7 +552,7 @@ static const char from_ucs4[][2] =
continue; \
} \
} \
- else if (from_ucs4[ch][0] == '\0' && ch != 0) \
+ else if (__builtin_expect (from_ucs4[ch][0], '\1') == '\0' && ch != 0) \
{ \
/* Illegal characters. */ \
if (! ignore_errors_p ()) \
@@ -570,7 +572,7 @@ static const char from_ucs4[][2] =
/* 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; \