Skip to content

Commit

Permalink
handy.h: Add some branch predictions
Browse files Browse the repository at this point in the history
  • Loading branch information
khwilliamson committed Apr 30, 2021
1 parent d5bb95a commit 8c82810
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions handy.h
Expand Up @@ -1906,11 +1906,11 @@ END_EXTERN_C
? (c) \
: ((! IN_UTF8_CTYPE_LOCALE) \
? (cast)function((cast)(c)) \
: ((((U8)(c)) == MICRO_SIGN) \
: (UNLIKELY(((U8)(c)) == MICRO_SIGN) \
? GREEK_CAPITAL_LETTER_MU \
: ((((U8)(c)) == LATIN_SMALL_LETTER_Y_WITH_DIAERESIS) \
: (UNLIKELY(((U8)(c)) == LATIN_SMALL_LETTER_Y_WITH_DIAERESIS) \
? LATIN_CAPITAL_LETTER_Y_WITH_DIAERESIS \
: ((((U8)(c)) == LATIN_SMALL_LETTER_SHARP_S) \
: (UNLIKELY(((U8)(c)) == LATIN_SMALL_LETTER_SHARP_S) \
? (__ASSERT_(0) (c)) \
: PL_mod_latin1_uc[ (U8) (c) ])))))

Expand All @@ -1924,7 +1924,7 @@ END_EXTERN_C
((UNLIKELY((c) == MICRO_SIGN) && IN_UTF8_CTYPE_LOCALE) \
? GREEK_SMALL_LETTER_MU \
: (__ASSERT_(! IN_UTF8_CTYPE_LOCALE \
|| (c) != LATIN_SMALL_LETTER_SHARP_S) \
|| LIKELY((c) != LATIN_SMALL_LETTER_SHARP_S)) \
generic_toLOWER_LC_(c, function, cast)))

/* Use the libc versions for these if available. */
Expand All @@ -1949,8 +1949,8 @@ END_EXTERN_C
* it gets. */
# define isCNTRL_LC(c) generic_LC_(c, _CC_CNTRL, iscntrl)
# define isSPACE_LC(c) generic_LC_(c, _CC_SPACE, isspace)
# define isIDFIRST_LC(c) ((c) == '_' || isALPHA_LC(c))
# define isWORDCHAR_LC(c) ((c) == '_' || isALPHANUMERIC_LC(c))
# define isIDFIRST_LC(c) (UNLIKELY((c) == '_') || isALPHA_LC(c))
# define isWORDCHAR_LC(c) (UNLIKELY((c) == '_') || isALPHANUMERIC_LC(c))

# define toLOWER_LC(c) generic_toLOWER_LC_((c), tolower, U8)
# define toUPPER_LC(c) generic_toUPPER_LC_((c), toupper, U8)
Expand Down

0 comments on commit 8c82810

Please sign in to comment.