summaryrefslogtreecommitdiff
path: root/iconvdata/ibm932.c
diff options
context:
space:
mode:
Diffstat (limited to 'iconvdata/ibm932.c')
-rw-r--r--iconvdata/ibm932.c18
1 files changed, 10 insertions, 8 deletions
diff --git a/iconvdata/ibm932.c b/iconvdata/ibm932.c
index 4ceeaae5b9..8adfb04f47 100644
--- a/iconvdata/ibm932.c
+++ b/iconvdata/ibm932.c
@@ -1,5 +1,5 @@
/* Conversion from and to IBM932.
- Copyright (C) 2000-2014 Free Software Foundation, Inc.
+ Copyright (C) 2000-2015 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Masahide Washizawa <washi@jp.ibm.com>, 2000.
@@ -29,6 +29,7 @@
#define CHARSET_NAME "IBM932//"
#define FROM_LOOP from_ibm932
#define TO_LOOP to_ibm932
+#define ONE_DIRECTION 0
/* Definitions of initialization and destructor function. */
#define DEFINE_INIT 1
@@ -64,7 +65,7 @@
if (__builtin_expect (res == 0, 0) && ch != 0) \
{ \
/* Use the IBM932 table for double byte. */ \
- if (__builtin_expect (inptr + 1 >= inend, 0)) \
+ if (__glibc_unlikely (inptr + 1 >= inend)) \
{ \
/* The second character is not available. \
Store the intermediate result. */ \
@@ -73,11 +74,12 @@
} \
\
ch = (ch * 0x100) + inptr[1]; \
+ /* ch was less than 0xfd. */ \
+ assert (ch < 0xfd00); \
while (ch > rp2->end) \
++rp2; \
\
- if (__builtin_expect (rp2 == NULL, 0) \
- || __builtin_expect (ch < rp2->start, 0) \
+ if (__builtin_expect (ch < rp2->start, 0) \
|| (res = __ibm932db_to_ucs4[ch + rp2->idx], \
__builtin_expect (res, '\1') == 0 && ch !=0)) \
{ \
@@ -134,7 +136,7 @@
uint32_t high; \
uint16_t pccode; \
\
- if (__builtin_expect (ch >= 0xffff, 0)) \
+ if (__glibc_unlikely (ch >= 0xffff)) \
{ \
UNICODE_TAG_HANDLER (ch, 4); \
rp = NULL; \
@@ -156,7 +158,7 @@
high = (sizeof (__ucs4_to_ibm932db) >> 1) \
/ sizeof (__ucs4_to_ibm932db[0][FROM]); \
pccode = ch; \
- if (__builtin_expect (rp != NULL, 1)) \
+ if (__glibc_likely (rp != NULL)) \
while (low < high) \
{ \
i = (low + high) >> 1; \
@@ -173,7 +175,7 @@
} \
if (found) \
{ \
- if (__builtin_expect (outptr + 2 > outend, 0)) \
+ if (__glibc_unlikely (outptr + 2 > outend)) \
{ \
result = __GCONV_FULL_OUTPUT; \
break; \
@@ -189,7 +191,7 @@
} \
else \
{ \
- if (__builtin_expect (outptr + 1 > outend, 0)) \
+ if (__glibc_unlikely (outptr + 1 > outend)) \
{ \
result = __GCONV_FULL_OUTPUT; \
break; \