diff options
author | Thiago Macieira <thiago.macieira@intel.com> | 2014-11-18 14:19:09 -0800 |
---|---|---|
committer | Thiago Macieira <thiago.macieira@intel.com> | 2014-12-13 05:10:28 +0100 |
commit | ef89efe137b7c32f4700d259e593bb35c7c264e2 (patch) | |
tree | 018532ee0b10b669128401f2e4f15efa7de1899e /src/corelib/tools/qtools_p.h | |
parent | cfe12f716b0e138b51e3d8f5e481c4d9624459dc (diff) |
Merge the multiple implementations of fromHex too
Change-Id: I8c22f784207dd8bffb88e70ac3c867abf0af86af
Reviewed-by: Jason McDonald <macadder1@gmail.com>
Diffstat (limited to 'src/corelib/tools/qtools_p.h')
-rw-r--r-- | src/corelib/tools/qtools_p.h | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/src/corelib/tools/qtools_p.h b/src/corelib/tools/qtools_p.h index 2acf3427f0..53d5228c3b 100644 --- a/src/corelib/tools/qtools_p.h +++ b/src/corelib/tools/qtools_p.h @@ -62,6 +62,17 @@ inline char toHexLower(uint value) static const char hexdigits[] = "0123456789abcdef"; return hexdigits[value & 0xF]; } + +inline int fromHex(uint c) +{ + if ((c >= '0') && (c <= '9')) + return c - '0'; + if ((c >= 'A') && (c <= 'F')) + return c - 'A' + 10; + if ((c >= 'a') && (c <= 'f')) + return c - 'a' + 10; + return -1; +} } // We typically need an extra bit for qNextPowerOfTwo when determining the next allocation size. |