mirror of
https://sourceware.org/git/glibc.git
synced 2025-08-08 17:42:12 +03:00
Add __builtin_expect in many places.
This commit is contained in:
@@ -4337,12 +4337,12 @@ static const char from_ucs4_extra[0x100][2] =
|
|||||||
{ \
|
{ \
|
||||||
uint32_t ch = *inptr; \
|
uint32_t ch = *inptr; \
|
||||||
\
|
\
|
||||||
if (ch == 0x5c) \
|
if (__builtin_expect (ch, 0) == 0x5c) \
|
||||||
{ \
|
{ \
|
||||||
ch = 0xa5; \
|
ch = 0xa5; \
|
||||||
++inptr; \
|
++inptr; \
|
||||||
} \
|
} \
|
||||||
else if (ch == 0x7e) \
|
else if (__builtin_expect (ch, 0) == 0x7e) \
|
||||||
{ \
|
{ \
|
||||||
ch = 0x203e; \
|
ch = 0x203e; \
|
||||||
++inptr; \
|
++inptr; \
|
||||||
@@ -4354,7 +4354,9 @@ static const char from_ucs4_extra[0x100][2] =
|
|||||||
ch = halfkana_to_ucs4[ch - 0xa1]; \
|
ch = halfkana_to_ucs4[ch - 0xa1]; \
|
||||||
++inptr; \
|
++inptr; \
|
||||||
} \
|
} \
|
||||||
else if (ch > 0xea || ch == 0xa0 || ch <= 0x80) \
|
else if (__builtin_expect (ch, 0) > 0xea \
|
||||||
|
|| __builtin_expect (ch, 0) == 0xa0 \
|
||||||
|
|| __builtin_expect (ch, 0x81) <= 0x80) \
|
||||||
{ \
|
{ \
|
||||||
/* These are illegal. */ \
|
/* These are illegal. */ \
|
||||||
if (! ignore_errors_p ()) \
|
if (! ignore_errors_p ()) \
|
||||||
@@ -4375,7 +4377,7 @@ static const char from_ucs4_extra[0x100][2] =
|
|||||||
uint32_t ch2; \
|
uint32_t ch2; \
|
||||||
uint_fast32_t idx; \
|
uint_fast32_t idx; \
|
||||||
\
|
\
|
||||||
if (NEED_LENGTH_TEST && inptr + 1 >= inend) \
|
if (NEED_LENGTH_TEST && __builtin_expect (inptr + 1 >= inend, 0)) \
|
||||||
{ \
|
{ \
|
||||||
/* The second character is not available. Store \
|
/* The second character is not available. Store \
|
||||||
the intermediate result. */ \
|
the intermediate result. */ \
|
||||||
@@ -4385,9 +4387,11 @@ static const char from_ucs4_extra[0x100][2] =
|
|||||||
\
|
\
|
||||||
ch2 = inptr[1]; \
|
ch2 = inptr[1]; \
|
||||||
idx = ch * 256 + ch2; \
|
idx = ch * 256 + ch2; \
|
||||||
if (idx < 0x8140 || (idx > 0x84be && idx < 0x889f) \
|
if (__builtin_expect (idx, 0x8140) < 0x8140 \
|
||||||
|| (idx > 0x88fc && idx < 0x8940) \
|
|| (__builtin_expect (idx, 0x8140) > 0x84be && idx < 0x889f) \
|
||||||
|| (idx > 0x9ffc && idx < 0xe040) || idx > 0xeaa4) \
|
|| (__builtin_expect (idx, 0x8140) > 0x88fc && idx < 0x8940) \
|
||||||
|
|| (__builtin_expect (idx, 0x8140) > 0x9ffc && idx < 0xe040) \
|
||||||
|
|| __builtin_expect (idx, 0x8140) > 0xeaa4) \
|
||||||
{ \
|
{ \
|
||||||
/* This is illegal. */ \
|
/* This is illegal. */ \
|
||||||
if (! ignore_errors_p ()) \
|
if (! ignore_errors_p ()) \
|
||||||
@@ -4418,7 +4422,7 @@ static const char from_ucs4_extra[0x100][2] =
|
|||||||
inptr += 2; \
|
inptr += 2; \
|
||||||
} \
|
} \
|
||||||
\
|
\
|
||||||
if (ch == 0) \
|
if (__builtin_expect (ch, 1) == 0) \
|
||||||
{ \
|
{ \
|
||||||
/* This is an illegal character. */ \
|
/* This is an illegal character. */ \
|
||||||
if (! ignore_errors_p ()) \
|
if (! ignore_errors_p ()) \
|
||||||
@@ -4456,7 +4460,8 @@ static const char from_ucs4_extra[0x100][2] =
|
|||||||
cp = from_ucs4_greek[ch - 0x391]; \
|
cp = from_ucs4_greek[ch - 0x391]; \
|
||||||
else if (ch >= 0x2010 && ch <= 0x9fa0) \
|
else if (ch >= 0x2010 && ch <= 0x9fa0) \
|
||||||
cp = from_ucs4_cjk[ch - 0x02010]; \
|
cp = from_ucs4_cjk[ch - 0x02010]; \
|
||||||
else if (ch >= 0xff01 && ch <= 0xffef) \
|
else if (__builtin_expect (ch, 0xff01) >= 0xff01 \
|
||||||
|
&& __builtin_expect (ch, 0xff01) <= 0xffef) \
|
||||||
cp = from_ucs4_extra[ch - 0xff00]; \
|
cp = from_ucs4_extra[ch - 0xff00]; \
|
||||||
else \
|
else \
|
||||||
{ \
|
{ \
|
||||||
@@ -4476,7 +4481,7 @@ static const char from_ucs4_extra[0x100][2] =
|
|||||||
else \
|
else \
|
||||||
cp = from_ucs4_lat1[ch]; \
|
cp = from_ucs4_lat1[ch]; \
|
||||||
\
|
\
|
||||||
if (cp[0] == '\0' && ch != 0) \
|
if (__builtin_expect (cp[0], '\1') == '\0' && ch != 0) \
|
||||||
{ \
|
{ \
|
||||||
/* Illegal character. */ \
|
/* Illegal character. */ \
|
||||||
if (! ignore_errors_p ()) \
|
if (! ignore_errors_p ()) \
|
||||||
@@ -4494,7 +4499,7 @@ static const char from_ucs4_extra[0x100][2] =
|
|||||||
/* Now test for a possible second byte and write this if possible. */\
|
/* Now test for a possible second byte and write this if possible. */\
|
||||||
if (cp[1] != '\0') \
|
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. */ \
|
/* The result does not fit into the buffer. */ \
|
||||||
result = __GCONV_FULL_OUTPUT; \
|
result = __GCONV_FULL_OUTPUT; \
|
||||||
|
@@ -382,14 +382,15 @@ static const char from_ucs4[][2] =
|
|||||||
#define BODY \
|
#define BODY \
|
||||||
{ \
|
{ \
|
||||||
uint32_t ch = *inptr; \
|
uint32_t ch = *inptr; \
|
||||||
|
int increment = 1; \
|
||||||
\
|
\
|
||||||
if (ch >= 0xc1 && ch <= 0xcf) \
|
if (__builtin_expect (ch, 0x20) >= 0xc1 && ch <= 0xcf) \
|
||||||
{ \
|
{ \
|
||||||
/* Composed character. First test whether the next character \
|
/* Composed character. First test whether the next character \
|
||||||
is also available. */ \
|
is also available. */ \
|
||||||
uint32_t ch2; \
|
uint32_t ch2; \
|
||||||
\
|
\
|
||||||
if (NEED_LENGTH_TEST && inptr + 1 >= inend) \
|
if (NEED_LENGTH_TEST && __builtin_expect (inptr + 1 >= inend, 0)) \
|
||||||
{ \
|
{ \
|
||||||
/* The second character is not available. */ \
|
/* The second character is not available. */ \
|
||||||
result = __GCONV_INCOMPLETE_INPUT; \
|
result = __GCONV_INCOMPLETE_INPUT; \
|
||||||
@@ -398,7 +399,8 @@ static const char from_ucs4[][2] =
|
|||||||
\
|
\
|
||||||
ch2 = inptr[1]; \
|
ch2 = inptr[1]; \
|
||||||
\
|
\
|
||||||
if (ch2 < 0x20 || ch2 >= 0x80) \
|
if (__builtin_expect (ch2, 0x20) < 0x20 \
|
||||||
|
|| __builtin_expect (ch2, 0x20) >= 0x80) \
|
||||||
{ \
|
{ \
|
||||||
/* This is illegal. */ \
|
/* This is illegal. */ \
|
||||||
if (! ignore_errors_p ()) \
|
if (! ignore_errors_p ()) \
|
||||||
@@ -415,21 +417,17 @@ static const char from_ucs4[][2] =
|
|||||||
\
|
\
|
||||||
ch = to_ucs4_comb[ch - 0xc1][ch2 - 0x20]; \
|
ch = to_ucs4_comb[ch - 0xc1][ch2 - 0x20]; \
|
||||||
\
|
\
|
||||||
inptr += 2; \
|
increment = 2; \
|
||||||
} \
|
} \
|
||||||
else \
|
else \
|
||||||
{ \
|
|
||||||
ch = to_ucs4[ch]; \
|
ch = to_ucs4[ch]; \
|
||||||
++inptr; \
|
|
||||||
} \
|
|
||||||
\
|
\
|
||||||
if (ch == 0 && *inptr != '\0') \
|
if (__builtin_expect (ch, 1) == 0 && *inptr != '\0') \
|
||||||
{ \
|
{ \
|
||||||
/* This is an illegal character. */ \
|
/* This is an illegal character. */ \
|
||||||
if (! ignore_errors_p ()) \
|
if (! ignore_errors_p ()) \
|
||||||
{ \
|
{ \
|
||||||
/* This is an illegal character. */ \
|
/* This is an illegal character. */ \
|
||||||
--inptr; \
|
|
||||||
result = __GCONV_ILLEGAL_INPUT; \
|
result = __GCONV_ILLEGAL_INPUT; \
|
||||||
break; \
|
break; \
|
||||||
} \
|
} \
|
||||||
@@ -441,6 +439,7 @@ static const char from_ucs4[][2] =
|
|||||||
put32 (outptr, ch); \
|
put32 (outptr, ch); \
|
||||||
outptr += 4; \
|
outptr += 4; \
|
||||||
} \
|
} \
|
||||||
|
inptr += increment; \
|
||||||
}
|
}
|
||||||
#include <iconv/loop.c>
|
#include <iconv/loop.c>
|
||||||
|
|
||||||
@@ -456,13 +455,16 @@ static const char from_ucs4[][2] =
|
|||||||
uint32_t ch = get32 (inptr); \
|
uint32_t ch = get32 (inptr); \
|
||||||
const char *cp; \
|
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 == 0x2126) \
|
if (__builtin_expect (ch, 0) == 0x2126) \
|
||||||
cp = "\xe0"; \
|
cp = "\xe0"; \
|
||||||
else if (ch == 0x2c7) \
|
else if (__builtin_expect (ch, 0) == 0x2c7) \
|
||||||
cp = "\xcf\x20"; \
|
cp = "\xcf\x20"; \
|
||||||
else if (ch < 0x2d8 || ch > 0x2dd || ch == 0x02dc) \
|
else if (__builtin_expect (ch, 0x2d8) < 0x2d8 \
|
||||||
|
|| __builtin_expect (ch, 0x2d8) > 0x2dd \
|
||||||
|
|| __builtin_expect (ch, 0x2d8) == 0x02dc) \
|
||||||
{ \
|
{ \
|
||||||
/* Illegal characters. */ \
|
/* Illegal characters. */ \
|
||||||
if (! ignore_errors_p ()) \
|
if (! ignore_errors_p ()) \
|
||||||
@@ -489,7 +491,7 @@ static const char from_ucs4[][2] =
|
|||||||
{ \
|
{ \
|
||||||
cp = from_ucs4[ch]; \
|
cp = from_ucs4[ch]; \
|
||||||
\
|
\
|
||||||
if (cp[0] == '\0' && ch != 0) \
|
if (__builtin_expect (cp[0], '\1') == '\0' && ch != 0) \
|
||||||
{ \
|
{ \
|
||||||
/* Illegal. */ \
|
/* Illegal. */ \
|
||||||
if (! ignore_errors_p ()) \
|
if (! ignore_errors_p ()) \
|
||||||
@@ -509,7 +511,7 @@ static const char from_ucs4[][2] =
|
|||||||
/* Now test for a possible second byte and write this if possible. */ \
|
/* Now test for a possible second byte and write this if possible. */ \
|
||||||
if (cp[1] != '\0') \
|
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. */ \
|
/* The result does not fit into the buffer. */ \
|
||||||
--outptr; \
|
--outptr; \
|
||||||
|
@@ -3063,7 +3063,9 @@ static const char uhc_hangul_from_ucs[11172][2] =
|
|||||||
*/ \
|
*/ \
|
||||||
if (ch <= 0x7f) \
|
if (ch <= 0x7f) \
|
||||||
++inptr; \
|
++inptr; \
|
||||||
else if (ch <= 0x80 || ch >= 0xfe || ch == 0xc9) \
|
else if (__builtin_expect (ch, 0x81) <= 0x80 \
|
||||||
|
|| __builtin_expect (ch, 0x81) >= 0xfe \
|
||||||
|
|| __builtin_expect (ch, 0x81) == 0xc9) \
|
||||||
{ \
|
{ \
|
||||||
/* This is illegal. */ \
|
/* This is illegal. */ \
|
||||||
if (! ignore_errors_p ()) \
|
if (! ignore_errors_p ()) \
|
||||||
@@ -3083,7 +3085,7 @@ static const char uhc_hangul_from_ucs[11172][2] =
|
|||||||
is also available. */ \
|
is also available. */ \
|
||||||
uint32_t ch2; \
|
uint32_t ch2; \
|
||||||
\
|
\
|
||||||
if (NEED_LENGTH_TEST && inptr + 1 >= inend) \
|
if (NEED_LENGTH_TEST && __builtin_expect (inptr + 1 >= inend, 0)) \
|
||||||
{ \
|
{ \
|
||||||
/* The second character is not available. Store \
|
/* The second character is not available. Store \
|
||||||
the intermediate result. */ \
|
the intermediate result. */ \
|
||||||
@@ -3113,8 +3115,11 @@ static const char uhc_hangul_from_ucs[11172][2] =
|
|||||||
\
|
\
|
||||||
if (ch < 0xa1 || ch2 < 0xa1) \
|
if (ch < 0xa1 || ch2 < 0xa1) \
|
||||||
{ \
|
{ \
|
||||||
if (ch > 0xc6 || ch2 <0x41 || (ch2 > 0x5a && ch2 < 0x61) \
|
if (__builtin_expect (ch, 0xc5) > 0xc6 \
|
||||||
|| (ch2 > 0x7a && ch2 < 0x81) || (ch == 0xc6 && ch2 > 0x52)) \
|
|| __builtin_expect (ch2, 0x41) < 0x41 \
|
||||||
|
|| (__builtin_expect (ch2, 0x41) > 0x5a && ch2 < 0x61) \
|
||||||
|
|| (__builtin_expect (ch2, 0x41) > 0x7a && ch2 < 0x81) \
|
||||||
|
|| (__builtin_expect (ch, 0xc5) == 0xc6 && ch2 > 0x52)) \
|
||||||
{ \
|
{ \
|
||||||
/* This is not legal. */ \
|
/* This is not legal. */ \
|
||||||
if (! ignore_errors_p ()) \
|
if (! ignore_errors_p ()) \
|
||||||
@@ -3135,7 +3140,7 @@ static const char uhc_hangul_from_ucs[11172][2] =
|
|||||||
? (ch - 0x81) * 178 \
|
? (ch - 0x81) * 178 \
|
||||||
: 5696 + (ch - 0xa1) * 84)]; \
|
: 5696 + (ch - 0xa1) * 84)]; \
|
||||||
\
|
\
|
||||||
if (ch == 0) \
|
if (__builtin_expect (ch, 1) == 0) \
|
||||||
{ \
|
{ \
|
||||||
/* This is an illegal character. */ \
|
/* This is an illegal character. */ \
|
||||||
if (! ignore_errors_p ()) \
|
if (! ignore_errors_p ()) \
|
||||||
@@ -3155,7 +3160,7 @@ static const char uhc_hangul_from_ucs[11172][2] =
|
|||||||
else \
|
else \
|
||||||
{ \
|
{ \
|
||||||
ch = ksc5601_to_ucs4 (&inptr, 2, 0x80); \
|
ch = ksc5601_to_ucs4 (&inptr, 2, 0x80); \
|
||||||
if (ch == __UNKNOWN_10646_CHAR) \
|
if (__builtin_expect (ch, 0) == __UNKNOWN_10646_CHAR) \
|
||||||
{ \
|
{ \
|
||||||
/* Illegal. */ \
|
/* Illegal. */ \
|
||||||
if (! ignore_errors_p ()) \
|
if (! ignore_errors_p ()) \
|
||||||
@@ -3194,7 +3199,7 @@ static const char uhc_hangul_from_ucs[11172][2] =
|
|||||||
{ \
|
{ \
|
||||||
const char *s = uhc_hangul_from_ucs[ch - 0xac00]; \
|
const char *s = uhc_hangul_from_ucs[ch - 0xac00]; \
|
||||||
\
|
\
|
||||||
if (NEED_LENGTH_TEST && outptr + 2 > outend) \
|
if (NEED_LENGTH_TEST && __builtin_expect (outptr + 2 > outend, 0)) \
|
||||||
{ \
|
{ \
|
||||||
result = __GCONV_FULL_OUTPUT; \
|
result = __GCONV_FULL_OUTPUT; \
|
||||||
break; \
|
break; \
|
||||||
@@ -3209,12 +3214,12 @@ static const char uhc_hangul_from_ucs[11172][2] =
|
|||||||
(NEED_LENGTH_TEST \
|
(NEED_LENGTH_TEST \
|
||||||
? outend - outptr : 2)); \
|
? outend - outptr : 2)); \
|
||||||
\
|
\
|
||||||
if (NEED_LENGTH_TEST && written == 0) \
|
if (NEED_LENGTH_TEST && __builtin_expect (written, 1) == 0) \
|
||||||
{ \
|
{ \
|
||||||
result = __GCONV_FULL_OUTPUT; \
|
result = __GCONV_FULL_OUTPUT; \
|
||||||
break; \
|
break; \
|
||||||
} \
|
} \
|
||||||
if (written == __UNKNOWN_10646_CHAR) \
|
if (__builtin_expect (written, 0) == __UNKNOWN_10646_CHAR) \
|
||||||
{ \
|
{ \
|
||||||
if (! ignore_errors_p ()) \
|
if (! ignore_errors_p ()) \
|
||||||
{ \
|
{ \
|
||||||
@@ -3241,12 +3246,12 @@ static const char uhc_hangul_from_ucs[11172][2] =
|
|||||||
(NEED_LENGTH_TEST \
|
(NEED_LENGTH_TEST \
|
||||||
? outend - outptr : 2)); \
|
? outend - outptr : 2)); \
|
||||||
\
|
\
|
||||||
if (NEED_LENGTH_TEST && written == 0) \
|
if (NEED_LENGTH_TEST && __builtin_expect (written, 1) == 0) \
|
||||||
{ \
|
{ \
|
||||||
result = __GCONV_FULL_OUTPUT; \
|
result = __GCONV_FULL_OUTPUT; \
|
||||||
break; \
|
break; \
|
||||||
} \
|
} \
|
||||||
if (written == __UNKNOWN_10646_CHAR) \
|
if (__builtin_expect (written, 0) == __UNKNOWN_10646_CHAR) \
|
||||||
{ \
|
{ \
|
||||||
if (! ignore_errors_p ()) \
|
if (! ignore_errors_p ()) \
|
||||||
{ \
|
{ \
|
||||||
|
@@ -63,7 +63,7 @@
|
|||||||
else if (!data->__internal_use && data->__invocation_counter == 0) \
|
else if (!data->__internal_use && data->__invocation_counter == 0) \
|
||||||
{ \
|
{ \
|
||||||
/* Emit the Byte Order Mark. */ \
|
/* Emit the Byte Order Mark. */ \
|
||||||
if (outbuf + 2 > outend) \
|
if (__builtin_expect (outbuf + 2 > outend, 0)) \
|
||||||
return __GCONV_FULL_OUTPUT; \
|
return __GCONV_FULL_OUTPUT; \
|
||||||
\
|
\
|
||||||
put16u (outbuf, BOM); \
|
put16u (outbuf, BOM); \
|
||||||
@@ -149,7 +149,7 @@ gconv_end (struct __gconv_step *data)
|
|||||||
{ \
|
{ \
|
||||||
uint32_t c = get32 (inptr); \
|
uint32_t c = get32 (inptr); \
|
||||||
\
|
\
|
||||||
if (c >= 0x10000) \
|
if (__builtin_expect (c, 0) >= 0x10000) \
|
||||||
{ \
|
{ \
|
||||||
if (! ignore_errors_p ()) \
|
if (! ignore_errors_p ()) \
|
||||||
{ \
|
{ \
|
||||||
|
@@ -66,7 +66,7 @@
|
|||||||
&& data->__invocation_counter == 0) \
|
&& data->__invocation_counter == 0) \
|
||||||
{ \
|
{ \
|
||||||
/* Emit the Byte Order Mark. */ \
|
/* Emit the Byte Order Mark. */ \
|
||||||
if (outbuf + 2 > outend) \
|
if (__builtin_expect (outbuf + 2 > outend, 0)) \
|
||||||
return __GCONV_FULL_OUTPUT; \
|
return __GCONV_FULL_OUTPUT; \
|
||||||
\
|
\
|
||||||
put16u (outbuf, BOM); \
|
put16u (outbuf, BOM); \
|
||||||
@@ -140,7 +140,7 @@ gconv_init (struct __gconv_step *step)
|
|||||||
}
|
}
|
||||||
|
|
||||||
result = __GCONV_NOCONV;
|
result = __GCONV_NOCONV;
|
||||||
if (dir != illegal_dir)
|
if (__builtin_expect (dir, to_utf16) != illegal_dir)
|
||||||
{
|
{
|
||||||
new_data = (struct utf16_data *) malloc (sizeof (struct utf16_data));
|
new_data = (struct utf16_data *) malloc (sizeof (struct utf16_data));
|
||||||
|
|
||||||
@@ -197,9 +197,9 @@ gconv_end (struct __gconv_step *data)
|
|||||||
\
|
\
|
||||||
if (swap) \
|
if (swap) \
|
||||||
{ \
|
{ \
|
||||||
if (c >= 0x10000) \
|
if (__builtin_expect (c, 0) >= 0x10000) \
|
||||||
{ \
|
{ \
|
||||||
if (c >= 0x110000) \
|
if (__builtin_expect (c, 0) >= 0x110000) \
|
||||||
{ \
|
{ \
|
||||||
if (! ignore_errors_p ()) \
|
if (! ignore_errors_p ()) \
|
||||||
{ \
|
{ \
|
||||||
@@ -214,7 +214,7 @@ gconv_end (struct __gconv_step *data)
|
|||||||
} \
|
} \
|
||||||
\
|
\
|
||||||
/* Generate a surrogate character. */ \
|
/* Generate a surrogate character. */ \
|
||||||
if (NEED_LENGTH_TEST && outptr + 4 > outend) \
|
if (NEED_LENGTH_TEST && __builtin_expect (outptr + 4 > outend, 0))\
|
||||||
{ \
|
{ \
|
||||||
/* Overflow in the output buffer. */ \
|
/* Overflow in the output buffer. */ \
|
||||||
result = __GCONV_FULL_OUTPUT; \
|
result = __GCONV_FULL_OUTPUT; \
|
||||||
@@ -230,9 +230,9 @@ gconv_end (struct __gconv_step *data)
|
|||||||
} \
|
} \
|
||||||
else \
|
else \
|
||||||
{ \
|
{ \
|
||||||
if (c >= 0x10000) \
|
if (__builtin_expect (c, 0) >= 0x10000) \
|
||||||
{ \
|
{ \
|
||||||
if (c >= 0x110000) \
|
if (__builtin_expect (c, 0) >= 0x110000) \
|
||||||
{ \
|
{ \
|
||||||
if (! ignore_errors_p ()) \
|
if (! ignore_errors_p ()) \
|
||||||
{ \
|
{ \
|
||||||
@@ -247,7 +247,7 @@ gconv_end (struct __gconv_step *data)
|
|||||||
} \
|
} \
|
||||||
\
|
\
|
||||||
/* Generate a surrogate character. */ \
|
/* Generate a surrogate character. */ \
|
||||||
if (NEED_LENGTH_TEST && outptr + 4 > outend) \
|
if (NEED_LENGTH_TEST && __builtin_expect (outptr + 4 > outend, 0))\
|
||||||
{ \
|
{ \
|
||||||
/* Overflow in the output buffer. */ \
|
/* Overflow in the output buffer. */ \
|
||||||
result = __GCONV_FULL_OUTPUT; \
|
result = __GCONV_FULL_OUTPUT; \
|
||||||
@@ -282,7 +282,7 @@ gconv_end (struct __gconv_step *data)
|
|||||||
{ \
|
{ \
|
||||||
u1 = bswap_16 (u1); \
|
u1 = bswap_16 (u1); \
|
||||||
\
|
\
|
||||||
if (u1 < 0xd800 || u1 > 0xdfff) \
|
if (__builtin_expect (u1, 0) < 0xd800 || u1 > 0xdfff) \
|
||||||
{ \
|
{ \
|
||||||
/* No surrogate. */ \
|
/* No surrogate. */ \
|
||||||
put32 (outptr, u1); \
|
put32 (outptr, u1); \
|
||||||
@@ -294,7 +294,7 @@ gconv_end (struct __gconv_step *data)
|
|||||||
\
|
\
|
||||||
/* It's a surrogate character. At least the first word says \
|
/* It's a surrogate character. At least the first word says \
|
||||||
it is. */ \
|
it is. */ \
|
||||||
if (NEED_LENGTH_TEST && inptr + 4 > inend) \
|
if (NEED_LENGTH_TEST && __builtin_expect (inptr + 4 > inend, 0)) \
|
||||||
{ \
|
{ \
|
||||||
/* We don't have enough input for another complete input \
|
/* We don't have enough input for another complete input \
|
||||||
character. */ \
|
character. */ \
|
||||||
@@ -304,7 +304,8 @@ gconv_end (struct __gconv_step *data)
|
|||||||
\
|
\
|
||||||
inptr += 2; \
|
inptr += 2; \
|
||||||
u2 = bswap_16 (get16 (inptr)); \
|
u2 = bswap_16 (get16 (inptr)); \
|
||||||
if (u2 < 0xdc00 || u2 >= 0xdfff) \
|
if (__builtin_expect (u2, 0xdc00) < 0xdc00 \
|
||||||
|
|| __builtin_expect (u2, 0xdc00) >= 0xdfff) \
|
||||||
{ \
|
{ \
|
||||||
/* This is no valid second word for a surrogate. */ \
|
/* This is no valid second word for a surrogate. */ \
|
||||||
if (! ignore_errors_p ()) \
|
if (! ignore_errors_p ()) \
|
||||||
@@ -324,7 +325,7 @@ gconv_end (struct __gconv_step *data)
|
|||||||
} \
|
} \
|
||||||
else \
|
else \
|
||||||
{ \
|
{ \
|
||||||
if (u1 < 0xd800 || u1 > 0xdfff) \
|
if (__builtin_expect (u1, 0) < 0xd800 || u1 > 0xdfff) \
|
||||||
{ \
|
{ \
|
||||||
/* No surrogate. */ \
|
/* No surrogate. */ \
|
||||||
put32 (outptr, u1); \
|
put32 (outptr, u1); \
|
||||||
@@ -336,7 +337,7 @@ gconv_end (struct __gconv_step *data)
|
|||||||
\
|
\
|
||||||
/* It's a surrogate character. At least the first word says \
|
/* It's a surrogate character. At least the first word says \
|
||||||
it is. */ \
|
it is. */ \
|
||||||
if (NEED_LENGTH_TEST && inptr + 4 > inend) \
|
if (NEED_LENGTH_TEST && __builtin_expect (inptr + 4 > inend, 0)) \
|
||||||
{ \
|
{ \
|
||||||
/* We don't have enough input for another complete input \
|
/* We don't have enough input for another complete input \
|
||||||
character. */ \
|
character. */ \
|
||||||
@@ -346,7 +347,8 @@ gconv_end (struct __gconv_step *data)
|
|||||||
\
|
\
|
||||||
inptr += 2; \
|
inptr += 2; \
|
||||||
u2 = get16 (inptr); \
|
u2 = get16 (inptr); \
|
||||||
if (u2 < 0xdc00 || u2 >= 0xdfff) \
|
if (__builtin_expect (u2, 0xdc00) < 0xdc00 \
|
||||||
|
|| __builtin_expect (u2, 0xdc00) >= 0xdfff) \
|
||||||
{ \
|
{ \
|
||||||
/* This is no valid second word for a surrogate. */ \
|
/* This is no valid second word for a surrogate. */ \
|
||||||
if (! ignore_errors_p ()) \
|
if (! ignore_errors_p ()) \
|
||||||
|
Reference in New Issue
Block a user