MINOR: tools: don't use unlikely() in hex2i()

This small inline function causes some pain to the compiler when used
inside other functions due to its use of the unlikely() hint for non-digits.
It causes the letters to be processed far away in the calling function and
makes the code less efficient. Removing these unlikely() hints has increased
the chunk size parsing by around 5%.
This commit is contained in:
Willy Tarreau 2017-11-10 11:19:54 +01:00
parent b15e3fefc9
commit aa39860aef
1 changed files with 3 additions and 3 deletions

View File

@ -317,9 +317,9 @@ extern int ishex(char s);
*/
static inline int hex2i(int c)
{
if (unlikely((unsigned char)(c -= '0') > 9)) {
if (likely((unsigned char)(c -= 'A' - '0') > 5 &&
(unsigned char)(c -= 'a' - 'A') > 5))
if ((unsigned char)(c -= '0') > 9) {
if ((unsigned char)(c -= 'A' - '0') > 5 &&
(unsigned char)(c -= 'a' - 'A') > 5)
c = -11;
c += 10;
}