/* Conversion from and to IBM1364.
- Copyright (C) 2005, 2008 Free Software Foundation, Inc.
+ Copyright (C) 2005-2015 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Masahide Washizawa <washi@jp.ibm.com>, 2005.
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
- License along with the GNU C Library; if not, write to the Free
- Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
- 02111-1307 USA. */
+ License along with the GNU C Library; if not, see
+ <http://www.gnu.org/licenses/>. */
#include <dlfcn.h>
#include <stdint.h>
#else
# define MAX_NEEDED_TO 4
#endif
+#define ONE_DIRECTION 0
#define PREPARE_LOOP \
int save_curcs; \
int *curcsp = &data->__statep->__count;
{ \
/* We are not in the initial state. To switch back we have \
to emit `SI'. */ \
- if (__builtin_expect (outbuf >= outend, 0)) \
+ if (__glibc_unlikely (outbuf >= outend)) \
/* We don't have enough room in the output buffer. */ \
status = __GCONV_FULL_OUTPUT; \
else \
else \
{ \
/* This is a combined character. Make sure we have room. */ \
- if (__builtin_expect (outptr + 8 > outend, 0)) \
+ if (__glibc_unlikely (outptr + 8 > outend)) \
{ \
result = __GCONV_FULL_OUTPUT; \
break; \
{ \
assert (curcs == db); \
\
- if (__builtin_expect (inptr + 1 >= inend, 0)) \
+ if (__glibc_unlikely (inptr + 1 >= inend)) \
{ \
/* The second character is not available. Store the \
intermediate result. */ \
++rp2; \
\
uint32_t res; \
- if (__builtin_expect (ch < rp2->start, 0) \
+ if (__builtin_expect (rp2->start == 0xffff, 0) \
+ || __builtin_expect (ch < rp2->start, 0) \
|| (res = DB_TO_UCS4[ch + rp2->idx], \
__builtin_expect (res, L'\1') == L'\0' && ch != '\0')) \
{ \
curcs = db; \
} \
\
- if (__builtin_expect (outptr + 2 > outend, 0)) \
+ if (__glibc_unlikely (outptr + 2 > outend)) \
{ \
result = __GCONV_FULL_OUTPUT; \
break; \
{ \
uint32_t ch = get32 (inptr); \
\
- if (__builtin_expect (ch >= UCS_LIMIT, 0)) \
+ if (__glibc_unlikely (ch >= UCS_LIMIT)) \
{ \
UNICODE_TAG_HANDLER (ch, 4); \
\
curcs = db; \
} \
\
- if (__builtin_expect (outptr + 2 > outend, 0)) \
+ if (__glibc_unlikely (outptr + 2 > outend)) \
{ \
result = __GCONV_FULL_OUTPUT; \
break; \
} \
else \
{ \
- if (__builtin_expect (curcs == db, 0)) \
+ if (__glibc_unlikely (curcs == db)) \
{ \
/* We know there is room for at least one byte. */ \
*outptr++ = SI; \
curcs = sb; \
\
- if (__builtin_expect (outptr >= outend, 0)) \
+ if (__glibc_unlikely (outptr >= outend)) \
{ \
result = __GCONV_FULL_OUTPUT; \
break; \