while (*inptrp < inend && cnt < 4)
state->__value.__wchb[cnt++] = *(*inptrp)++;
- if (cnt < 4)
+ if (__builtin_expect (cnt, 4) < 4)
{
/* Still not enough bytes. Store the ones in the input buffer. */
state->__count &= ~7;
inval = *(uint32_t *) inptr;
#endif
- if (inval > 0x7fffffff)
+ if (__builtin_expect (inval, 0) > 0x7fffffff)
{
if (flags & __GCONV_IGNORE_ERRORS)
{
for (cnt = 0; cnt < n_convert; ++cnt, inptr += 4, outptr += 4)
{
- if (inptr[0] > 0x80)
+ if (__builtin_expect (inptr[0], 0) > 0x80)
{
/* The value is too large. */
if (flags & __GCONV_IGNORE_ERRORS)
while (*inptrp < inend && cnt < 4)
state->__value.__wchb[cnt++] = *(*inptrp)++;
- if (cnt < 4)
+ if (__builtin_expect (cnt, 4) < 4)
{
/* Still not enough bytes. Store the ones in the input buffer. */
state->__count &= ~7;
return __GCONV_INCOMPLETE_INPUT;
}
- if (((unsigned char *) state->__value.__wchb)[0] > 0x80)
+ if (__builtin_expect (((unsigned char *) state->__value.__wchb)[0], 0)
+ > 0x80)
{
/* The value is too large. */
if (!(flags & __GCONV_IGNORE_ERRORS))
while (*inptrp < inend && cnt < 4)
state->__value.__wchb[cnt++] = *(*inptrp)++;
- if (cnt < 4)
+ if (__builtin_expect (cnt, 4) < 4)
{
/* Still not enough bytes. Store the ones in the input buffer. */
state->__count &= ~7;
inval = *(uint32_t *) inptr;
#endif
- if (inval > 0x7fffffff)
+ if (__builtin_expect (inval, 0) > 0x7fffffff)
{
if (flags & __GCONV_IGNORE_ERRORS)
{
for (cnt = 0; cnt < n_convert; ++cnt, inptr += 4)
{
- if (inptr[3] > 0x80)
+ if (__builtin_expect (inptr[3], 0) > 0x80)
{
/* The value is too large. */
if (flags & __GCONV_IGNORE_ERRORS)
while (*inptrp < inend && cnt < 4)
state->__value.__wchb[cnt++] = *(*inptrp)++;
- if (cnt < 4)
+ if (__builtin_expect (cnt, 4) < 4)
{
/* Still not enough bytes. Store the ones in the input buffer. */
state->__count &= ~7;
return __GCONV_INCOMPLETE_INPUT;
}
- if (((unsigned char *) state->__value.__wchb)[3] > 0x80)
+ if (__builtin_expect (((unsigned char *) state->__value.__wchb)[3], 0)
+ > 0x80)
{
/* The value is too large. */
if (!(flags & __GCONV_IGNORE_ERRORS))
#define LOOPFCT FROM_LOOP
#define BODY \
{ \
- if (*inptr > '\x7f') \
+ if (__builtin_expect (*inptr, 0) > '\x7f') \
{ \
if (! ignore_errors_p ()) \
{ \
#define LOOPFCT FROM_LOOP
#define BODY \
{ \
- if (*((uint32_t *) inptr) > 0x7f) \
+ if (__builtin_expect (*((uint32_t *) inptr), 0) > 0x7f) \
{ \
if (! ignore_errors_p ()) \
{ \
if ((wc & encoding_mask[step - 2]) == 0) \
break; \
\
- if (outptr + step > outend) \
+ if (__builtin_expect (outptr + step > outend, 0)) \
{ \
/* Too long. */ \
result = __GCONV_FULL_OUTPUT; \
cnt = 2; \
ch &= 0x1f; \
} \
- else if ((ch & 0xf0) == 0xe0) \
+ else if (__builtin_expect (ch & 0xf0, 0xf0) == 0xe0) \
{ \
/* We expect three bytes. */ \
cnt = 3; \
ch &= 0x0f; \
} \
- else if ((ch & 0xf8) == 0xf0) \
+ else if (__builtin_expect (ch & 0xf8, 0xf8) == 0xf0) \
{ \
/* We expect four bytes. */ \
cnt = 4; \
ch &= 0x07; \
} \
- else if ((ch & 0xfc) == 0xf8) \
+ else if (__builtin_expect (ch & 0xfc, 0xf8) == 0xf8) \
{ \
/* We expect five bytes. */ \
cnt = 5; \
ch &= 0x03; \
} \
- else if ((ch & 0xfe) == 0xfc) \
+ else if (__builtin_expect (ch & 0xfe, 0xfc) == 0xfc) \
{ \
/* We expect six bytes. */ \
cnt = 6; \
continue; \
} \
\
- if (NEED_LENGTH_TEST && inptr + cnt > inend) \
+ if (NEED_LENGTH_TEST && __builtin_expect (inptr + cnt > inend, 0)) \
{ \
/* We don't have enough input. But before we report that check \
that all the bytes are correct. */ \
if ((inptr[i] & 0xc0) != 0x80) \
break; \
\
- if (inptr + i == inend) \
+ if (__builtin_expect (inptr + i == inend, 1)) \
{ \
result = __GCONV_INCOMPLETE_INPUT; \
break; \
cnt = 2; \
ch &= 0x1f; \
} \
- else if ((ch & 0xf0) == 0xe0) \
+ else if (__builtin_expect (ch & 0xf0, 0xe0) == 0xe0) \
{ \
/* We expect three bytes. */ \
cnt = 3; \
ch &= 0x0f; \
} \
- else if ((ch & 0xf8) == 0xf0) \
+ else if (__builtin_expect (ch & 0xf8, 0xf8) == 0xf0) \
{ \
/* We expect four bytes. */ \
cnt = 4; \
ch &= 0x07; \
} \
- else if ((ch & 0xfc) == 0xf8) \
+ else if (__builtin_expect (ch & 0xfc, 0xfc) == 0xf8) \
{ \
/* We expect five bytes. */ \
cnt = 5; \
bytebuf[0] = 0xc0; \
ntotal = 2; \
} \
- else if (state->__value.__wch <= 0xffff) \
+ else if (__builtin_expect (state->__value.__wch, 0) <= 0xffff) \
{ \
bytebuf[0] = 0xe0; \
ntotal = 3; \
} \
- else if (state->__value.__wch <= 0x1fffff) \
+ else if (__builtin_expect (state->__value.__wch, 0) <= 0x1fffff) \
{ \
bytebuf[0] = 0xf0; \
ntotal = 4; \
} \
- else if (state->__value.__wch <= 0x3ffffff) \
+ else if (__builtin_expect (state->__value.__wch, 0) <= 0x3ffffff) \
{ \
bytebuf[0] = 0xf8; \
ntotal = 5; \
#define LOOPFCT FROM_LOOP
#define BODY \
{ \
- if (*((uint32_t *) inptr) >= 0x10000) \
+ if (__builtin_expect (*((uint32_t *) inptr), 0) >= 0x10000) \
{ \
if (! ignore_errors_p ()) \
{ \
#define BODY \
{ \
uint32_t val = *((uint32_t *) inptr); \
- if (val >= 0x10000) \
+ if (__builtin_expect (val, 0) >= 0x10000) \
{ \
if (! ignore_errors_p ()) \
{ \
step->__min_needed_to = MIN_NEEDED_TO;
step->__max_needed_to = MAX_NEEDED_TO;
}
- else if (strcmp (step->__to_name, CHARSET_NAME) == 0)
+ else if (__builtin_expect (strcmp (step->__to_name, CHARSET_NAME), 0) == 0)
{
step->__data = &to_object;
EXTRA_LOOP_ARGS);
# endif
- if (status != __GCONV_OK)
+ if (__builtin_expect (status, __GCONV_OK) != __GCONV_OK)
return status;
}
#endif
SAVE_RESET_STATE (1);
#endif
- if (!unaligned)
+ if (__builtin_expect (!unaligned, 1))
{
if (FROM_DIRECTION)
/* Run the conversion loop. */
/* If this is the last step leave the loop, there is nothing
we can do. */
- if (data->__flags & __GCONV_IS_LAST)
+ if (__builtin_expect (data->__flags & __GCONV_IS_LAST, 0))
{
/* Store information about how many bytes are available. */
data->__outbuf = outbuf;
}
/* Write out all output which was produced. */
- if (outbuf > outstart)
+ if (__builtin_expect (outbuf > outstart, 1))
{
const unsigned char *outerr = data->__outbuf;
int result;
/* If we haven't consumed a single byte decrement
the invocation counter. */
- if (outbuf == outstart)
+ if (__builtin_expect (outbuf == outstart, 0))
--data->__invocation_counter;
#endif /* reset input buffer */
}
#if MAX_NEEDED_FROM > 1 || MAX_NEEDED_TO > 1
if (((MAX_NEEDED_FROM > 1 && FROM_DIRECTION)
|| (MAX_NEEDED_TO > 1 && !FROM_DIRECTION))
- && consume_incomplete && status == __GCONV_INCOMPLETE_INPUT)
+ && __builtin_expect (consume_incomplete, 0)
+ && status == __GCONV_INCOMPLETE_INPUT)
{
# ifdef STORE_REST
mbstate_t *state = data->__statep;