aboutsummaryrefslogtreecommitdiff
path: root/iconvdata
diff options
context:
space:
mode:
authorUlrich Drepper <drepper@redhat.com>2000-06-06 06:49:00 +0000
committerUlrich Drepper <drepper@redhat.com>2000-06-06 06:49:00 +0000
commit5ea1a82defd37feaa6be1faf44854364c901cdaf (patch)
tree9fad50dfb181485bb4ca62c9d96e0d31376dce07 /iconvdata
parent365afefc6b7054d9ca7585f6f17bdd1fe03b8cfd (diff)
downloadglibc-5ea1a82defd37feaa6be1faf44854364c901cdaf.zip
glibc-5ea1a82defd37feaa6be1faf44854364c901cdaf.tar.gz
glibc-5ea1a82defd37feaa6be1faf44854364c901cdaf.tar.bz2
Update.
* iconvdata/big5hkscs.c: Add __builtin_expect in many places. * iconvdata/big5.c: Likewise. * iconvdata/ansi_x3.110.c: Likewise. * iconvdata/8bit-generic.c: Likewise. * iconvdata/8bit-gap.c: Likewise. * iconv/loop.c: Likewise. * iconv/gconv_db.c: Likewise. * iconv/gconv_dl.c: Likewise. * iconv/gconv_simple.c: Likewise. * iconv/skeleton.c: Likewise.
Diffstat (limited to 'iconvdata')
-rw-r--r--iconvdata/8bit-gap.c8
-rw-r--r--iconvdata/8bit-generic.c6
-rw-r--r--iconvdata/ansi_x3.110.c16
-rw-r--r--iconvdata/big5.c13
-rw-r--r--iconvdata/big5hkscs.c13
5 files changed, 32 insertions, 24 deletions
diff --git a/iconvdata/8bit-gap.c b/iconvdata/8bit-gap.c
index c805d5e..75493f7 100644
--- a/iconvdata/8bit-gap.c
+++ b/iconvdata/8bit-gap.c
@@ -48,7 +48,7 @@ struct gap
{ \
uint32_t ch = to_ucs4[*inptr]; \
\
- if (HAS_HOLES && ch == L'\0' && *inptr != '\0') \
+ if (HAS_HOLES && __builtin_expect (ch, L'\1') == L'\0' && *inptr != '\0') \
{ \
/* This is an illegal character. */ \
if (! ignore_errors_p ()) \
@@ -80,7 +80,7 @@ struct gap
uint32_t ch = get32 (inptr); \
unsigned char res; \
\
- if (ch >= 0xffff) \
+ if (__builtin_expect (ch, 0) >= 0xffff) \
{ \
/* This is an illegal character. */ \
if (! ignore_errors_p ()) \
@@ -95,7 +95,7 @@ struct gap
} \
while (ch > rp->end) \
++rp; \
- if (ch < rp->start) \
+ if (__builtin_expect (ch < rp->start, 0)) \
{ \
/* This is an illegal character. */ \
if (! ignore_errors_p ()) \
@@ -110,7 +110,7 @@ struct gap
} \
\
res = from_ucs4[ch + rp->idx]; \
- if (ch != 0 && res == '\0') \
+ if (__builtin_expect (res, '\1') == '\0' && ch != 0) \
{ \
/* This is an illegal character. */ \
if (! ignore_errors_p ()) \
diff --git a/iconvdata/8bit-generic.c b/iconvdata/8bit-generic.c
index 3b6b47a..398bd67 100644
--- a/iconvdata/8bit-generic.c
+++ b/iconvdata/8bit-generic.c
@@ -34,7 +34,7 @@
{ \
uint32_t ch = to_ucs4[*inptr]; \
\
- if (HAS_HOLES && ch == L'\0' && *inptr != '\0') \
+ if (HAS_HOLES && __builtin_expect (ch, L'\1') == L'\0' && *inptr != '\0') \
{ \
/* This is an illegal character. */ \
if (! ignore_errors_p ()) \
@@ -61,8 +61,8 @@
{ \
uint32_t ch = get32 (inptr); \
\
- if (ch >= sizeof (from_ucs4) / sizeof (from_ucs4[0]) \
- || (ch != 0 && from_ucs4[ch] == '\0')) \
+ if (__builtin_expect (ch >= sizeof (from_ucs4) / sizeof (from_ucs4[0]), 0)\
+ || (__builtin_expect (from_ucs4[ch], '\1') == '\0' && ch != 0)) \
{ \
/* This is an illegal character. */ \
if (! ignore_errors_p ()) \
diff --git a/iconvdata/ansi_x3.110.c b/iconvdata/ansi_x3.110.c
index 94bd2e6..bacbfd2 100644
--- a/iconvdata/ansi_x3.110.c
+++ b/iconvdata/ansi_x3.110.c
@@ -401,7 +401,7 @@ static const char from_ucs4[][2] =
uint32_t ch = *inptr; \
int incr; \
\
- if (ch >= 0xc1 && ch <= 0xcf) \
+ if (__builtin_expect (ch, 0x00) >= 0xc1 && ch <= 0xcf) \
{ \
/* Composed character. First test whether the next character \
is also available. */ \
@@ -416,7 +416,8 @@ static const char from_ucs4[][2] =
\
ch2 = inptr[1]; \
\
- if (ch2 < 0x20 || ch2 >= 0x80) \
+ if (__builtin_expect (ch2, 0x20) < 0x20 \
+ || __builtin_expect (ch2, 0x7f) >= 0x80) \
{ \
/* This is illegal. */ \
if (! ignore_errors_p ()) \
@@ -440,7 +441,7 @@ static const char from_ucs4[][2] =
incr = 1; \
} \
\
- if (ch == 0 && *inptr != '\0') \
+ if (__builtin_expect (ch, 1) == 0 && *inptr != '\0') \
{ \
/* This is an illegal character. */ \
if (! ignore_errors_p ()) \
@@ -471,7 +472,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])) \
{ \
if (ch == 0x2c7) \
cp = "\xcf\x20"; \
@@ -536,7 +538,7 @@ static const char from_ucs4[][2] =
tmp[1] = '\0'; \
cp = tmp; \
} \
- else if (ch == 0x266a) \
+ else if (__builtin_expect (ch, 0x266a) == 0x266a) \
cp = "\xd5"; \
else \
{ \
@@ -556,7 +558,7 @@ static const char from_ucs4[][2] =
{ \
cp = from_ucs4[ch]; \
\
- if (cp[0] == '\0' && ch != 0) \
+ if (__builtin_expect (cp[0], '\1') == '\0' && ch != 0) \
{ \
/* Illegal characters. */ \
if (! ignore_errors_p ()) \
@@ -575,7 +577,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; \
diff --git a/iconvdata/big5.c b/iconvdata/big5.c
index 0e4ca74..363b250 100644
--- a/iconvdata/big5.c
+++ b/iconvdata/big5.c
@@ -8450,7 +8450,8 @@ static const char from_ucs4_tab13[][2] =
/* See whether the second byte is in the correct range. */ \
if (ch2 >= 0x40 && ch2 <= 0x7e) \
idx += ch2 - 0x40; \
- else if (ch2 >= 0xa1 && ch2 <= 0xfe) \
+ else if (__builtin_expect (ch2, 0xa1) >= 0xa1 \
+ && __builtin_expect (ch2, 0xa1) <= 0xfe) \
idx += 0x3f + (ch2 - 0xa1); \
else \
{ \
@@ -8470,7 +8471,7 @@ static const char from_ucs4_tab13[][2] =
ch = big5_to_ucs[idx]; \
\
/* Is this character defined? */ \
- if (ch == 0 && *inptr != '\0') \
+ if (__builtin_expect (ch, 1) == 0 && *inptr != '\0') \
{ \
/* This is an illegal character. */ \
if (! ignore_errors_p ()) \
@@ -8506,7 +8507,8 @@ static const char from_ucs4_tab13[][2] =
char buf[2]; \
const char *cp; \
\
- if (ch >= sizeof (from_ucs4_tab1) / sizeof (from_ucs4_tab1[0])) \
+ if (__builtin_expect (ch, 0) \
+ >= sizeof (from_ucs4_tab1) / sizeof (from_ucs4_tab1[0])) \
switch (ch) \
{ \
case 0x2c7 ... 0x2d9: \
@@ -8578,7 +8580,7 @@ static const char from_ucs4_tab13[][2] =
else \
cp = from_ucs4_tab1[ch]; \
\
- if (cp[0] == '\0' && ch != 0) \
+ if (__builtin_expect (cp[0], '\1') == '\0' && ch != 0) \
{ \
/* Illegal character. */ \
if (! ignore_errors_p ()) \
@@ -8592,7 +8594,8 @@ static const char from_ucs4_tab13[][2] =
else \
{ \
/* See whether there is enough room for the second byte we write. */ \
- if (NEED_LENGTH_TEST && cp[1] != '\0' && outptr + 1 >= outend) \
+ if (NEED_LENGTH_TEST && __builtin_expect (cp[1], '\1') != '\0' \
+ && __builtin_expect (outptr + 1 >= outend, 0)) \
{ \
/* We have not enough room. */ \
result = __GCONV_FULL_OUTPUT; \
diff --git a/iconvdata/big5hkscs.c b/iconvdata/big5hkscs.c
index 09974d5..083b077 100644
--- a/iconvdata/big5hkscs.c
+++ b/iconvdata/big5hkscs.c
@@ -12604,7 +12604,8 @@ static const char from_ucs4_tab14[][2] =
/* See whether the second byte is in the correct range. */ \
if (ch2 >= 0x40 && ch2 <= 0x7e) \
idx += ch2 - 0x40; \
- else if (ch2 >= 0xa1 && ch2 <= 0xfe) \
+ else if (__builtin_expect (ch2, 0xa1) >= 0xa1 \
+ && __builtin_expect (ch2, 0xa1) <= 0xfe) \
idx += 0x3f + (ch2 - 0xa1); \
else \
{ \
@@ -12624,7 +12625,7 @@ static const char from_ucs4_tab14[][2] =
ch = big5_to_ucs[idx]; \
\
/* Is this character defined? */ \
- if (ch == 0 && *inptr != '\0') \
+ if (__builtin_expect (ch, 1) == 0 && *inptr != '\0') \
{ \
/* This is an illegal character. */ \
if (! ignore_errors_p ()) \
@@ -12660,7 +12661,8 @@ static const char from_ucs4_tab14[][2] =
char buf[2]; \
const char *cp; \
\
- if (ch >= sizeof (from_ucs4_tab1) / sizeof (from_ucs4_tab1[0])) \
+ if (__builtin_expect (ch, 0) \
+ >= sizeof (from_ucs4_tab1) / sizeof (from_ucs4_tab1[0])) \
switch (ch) \
{ \
case 0x2c7 ... 0x2d9: \
@@ -12735,7 +12737,7 @@ static const char from_ucs4_tab14[][2] =
else \
cp = from_ucs4_tab1[ch]; \
\
- if (cp[0] == '\0' && ch != 0) \
+ if (__builtin_expect (cp[0], '\1') == '\0' && ch != 0) \
{ \
/* Illegal character. */ \
if (! ignore_errors_p ()) \
@@ -12749,7 +12751,8 @@ static const char from_ucs4_tab14[][2] =
else \
{ \
/* See whether there is enough room for the second byte we write. */ \
- if (NEED_LENGTH_TEST && cp[1] != '\0' && outptr + 1 >= outend) \
+ if (NEED_LENGTH_TEST && __builtin_expect (cp[1], '\1') != '\0' \
+ && __builtin_expect (outptr + 1 >= outend, 0)) \
{ \
/* We have not enough room. */ \
result = __GCONV_FULL_OUTPUT; \