Browse Source

Make fromhex() even faster

dynamic-accesslists
erdgeist 17 years ago
parent
commit
dba3bb3ae7
  1. 8
      scan_urlencoded_query.c

8
scan_urlencoded_query.c

@ -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 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) { static unsigned char fromhex(unsigned char x) {
if (c>='0' && c<='9') return c-'0'; x-='0'; if( x<=9) return x;
c &= 0xdf; /* Toggle off lower case bit */ x&=~0x20; x-='A'-'0';
if (c>='A' && c<='F') return c-'A'+10; if( x<6 ) return x+10;
return 0xff; return 0xff;
} }

Loading…
Cancel
Save