Skip to content

Commit

Permalink
* iconv/gconv_simple.c: Add some branch prediction.
Browse files Browse the repository at this point in the history
  • Loading branch information
Ulrich Drepper committed Oct 12, 2007
1 parent 6dd3748 commit 26a5106
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 9 deletions.
4 changes: 4 additions & 0 deletions ChangeLog
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
2007-10-11 Ulrich Drepper <drepper@redhat.com>

* iconv/gconv_simple.c: Add some branch prediction.

2007-10-12 Jakub Jelinek <jakub@redhat.com>

* locale/programs/ld-collate.c (collate_read): If ignore_content
Expand Down
16 changes: 7 additions & 9 deletions iconv/gconv_simple.c
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/* Simple transformations functions.
Copyright (C) 1997-2003, 2004, 2005 Free Software Foundation, Inc.
Copyright (C) 1997-2003, 2004, 2005, 2007 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997.
Expand Down Expand Up @@ -880,7 +880,7 @@ ucs4le_internal_loop_single (struct __gconv_step *step,
{ \
uint32_t wc = *((const uint32_t *) inptr); \
\
if (wc < 0x80) \
if (__builtin_expect (wc < 0x80, 1)) \
/* It's an one byte sequence. */ \
*outptr++ = (unsigned char) wc; \
else if (__builtin_expect (wc <= 0x7fffffff, 1)) \
Expand Down Expand Up @@ -940,21 +940,19 @@ ucs4le_internal_loop_single (struct __gconv_step *step,
#define LOOPFCT FROM_LOOP
#define BODY \
{ \
uint32_t ch; \
uint_fast32_t cnt; \
uint_fast32_t i; \
\
/* Next input byte. */ \
ch = *inptr; \
uint32_t ch = *inptr; \
\
if (ch < 0x80) \
if (__builtin_expect (ch < 0x80, 1)) \
{ \
/* One byte sequence. */ \
cnt = 1; \
++inptr; \
} \
else \
{ \
uint_fast32_t cnt; \
uint_fast32_t i; \
\
if (ch >= 0xc2 && ch < 0xe0) \
{ \
/* We expect two bytes. The first byte cannot be 0xc0 or 0xc1, \
Expand Down

0 comments on commit 26a5106

Please sign in to comment.