mirror of
https://github.com/boostorg/beast.git
synced 2025-07-30 12:57:31 +02:00
Faster ascii_tolower
This commit is contained in:
@ -1,6 +1,7 @@
|
|||||||
Version 146:
|
Version 146:
|
||||||
|
|
||||||
* Fix some typos
|
* Fix some typos
|
||||||
|
* Faster ascii_tolower
|
||||||
|
|
||||||
--------------------------------------------------------------------------------
|
--------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
@ -55,9 +55,8 @@ inline
|
|||||||
char
|
char
|
||||||
ascii_tolower(char c)
|
ascii_tolower(char c)
|
||||||
{
|
{
|
||||||
if(c >= 'A' && c <= 'Z')
|
return ((static_cast<unsigned>(c) - 65U) < 26) ?
|
||||||
c += 'a' - 'A';
|
c + 'a' - 'A' : c;
|
||||||
return c;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
template<class = void>
|
template<class = void>
|
||||||
@ -77,17 +76,18 @@ iequals(
|
|||||||
a = *p1++;
|
a = *p1++;
|
||||||
b = *p2++;
|
b = *p2++;
|
||||||
if(a != b)
|
if(a != b)
|
||||||
goto slow;
|
{
|
||||||
}
|
// slow loop
|
||||||
return true;
|
do
|
||||||
|
{
|
||||||
while(n--)
|
if(ascii_tolower(a) != ascii_tolower(b))
|
||||||
{
|
return false;
|
||||||
slow:
|
a = *p1++;
|
||||||
if(ascii_tolower(a) != ascii_tolower(b))
|
b = *p2++;
|
||||||
return false;
|
}
|
||||||
a = *p1++;
|
while(n--);
|
||||||
b = *p2++;
|
return true;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user