summaryrefslogtreecommitdiffstats
path: root/net
diff options
context:
space:
mode:
authordeanm@chromium.org <deanm@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2008-09-10 17:50:13 +0000
committerdeanm@chromium.org <deanm@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2008-09-10 17:50:13 +0000
commitf23527b58cf9116c1d4fa37d64ed692485cf6709 (patch)
tree1cbf27221ff09a25211d9de40a0893c11acb65b3 /net
parent48ff9f9e3567568e953f56c8156fd376361c3edd (diff)
downloadchromium_src-f23527b58cf9116c1d4fa37d64ed692485cf6709.zip
chromium_src-f23527b58cf9116c1d4fa37d64ed692485cf6709.tar.gz
chromium_src-f23527b58cf9116c1d4fa37d64ed692485cf6709.tar.bz2
Do a better job at bounding HexToInt.
http://codereview.chromium.org/1703 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@1994 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'net')
-rw-r--r--net/base/net_util.cc2
1 files changed, 1 insertions, 1 deletions
diff --git a/net/base/net_util.cc b/net/base/net_util.cc
index aa01f1f..2064af7 100644
--- a/net/base/net_util.cc
+++ b/net/base/net_util.cc
@@ -154,7 +154,7 @@ inline bool IsHexDigit(unsigned char c) {
inline unsigned char HexToInt(unsigned char c) {
DCHECK(IsHexDigit(c));
static unsigned char kOffset[4] = {0, 0x30u, 0x37u, 0x57u};
- return c - kOffset[c / 0x20];
+ return c - kOffset[(c >> 5) & 3];
}
// Similar to Base64Decode. Decodes a Q-encoded string to a sequence