diff options
author | erdgeist <> | 2007-10-18 11:50:54 +0000 |
---|---|---|
committer | erdgeist <> | 2007-10-18 11:50:54 +0000 |
commit | dba3bb3ae7957773f9799a14d6f7b47f08b7c03b (patch) | |
tree | 8c5bfe4d530626e89b84b7b88587c1ba42ad0949 | |
parent | 243d5961d0425b199319967e1c296c5d0124f3f2 (diff) |
Make fromhex() even faster
-rw-r--r-- | scan_urlencoded_query.c | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/scan_urlencoded_query.c b/scan_urlencoded_query.c index f61d79e..a11b65c 100644 --- a/scan_urlencoded_query.c +++ b/scan_urlencoded_query.c | |||
@@ -25,10 +25,10 @@ static const unsigned char is_unreserved[256] = { | |||
25 | 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 | 25 | 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 |
26 | }; | 26 | }; |
27 | 27 | ||
28 | static unsigned char fromhex(unsigned char c) { | 28 | static unsigned char fromhex(unsigned char x) { |
29 | if (c>='0' && c<='9') return c-'0'; | 29 | x-='0'; if( x<=9) return x; |
30 | c &= 0xdf; /* Toggle off lower case bit */ | 30 | x&=~0x20; x-='A'-'0'; |
31 | if (c>='A' && c<='F') return c-'A'+10; | 31 | if( x<6 ) return x+10; |
32 | return 0xff; | 32 | return 0xff; |
33 | } | 33 | } |
34 | 34 | ||