mirror of
git://erdgeist.org/opentracker
synced 2025-02-16 22:21:30 +08:00
Make fromhex() even faster
This commit is contained in:
parent
243d5961d0
commit
dba3bb3ae7
@ -25,10 +25,10 @@ static const unsigned char is_unreserved[256] = {
|
||||
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
|
||||
};
|
||||
|
||||
static unsigned char fromhex(unsigned char c) {
|
||||
if (c>='0' && c<='9') return c-'0';
|
||||
c &= 0xdf; /* Toggle off lower case bit */
|
||||
if (c>='A' && c<='F') return c-'A'+10;
|
||||
static unsigned char fromhex(unsigned char x) {
|
||||
x-='0'; if( x<=9) return x;
|
||||
x&=~0x20; x-='A'-'0';
|
||||
if( x<6 ) return x+10;
|
||||
return 0xff;
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user