diff options
author | Thiago Macieira <thiago.macieira@intel.com> | 2014-11-18 13:46:21 -0800 |
---|---|---|
committer | Thiago Macieira <thiago.macieira@intel.com> | 2014-12-13 05:10:20 +0100 |
commit | cfe12f716b0e138b51e3d8f5e481c4d9624459dc (patch) | |
tree | 26232a23b4985ba8984a139e03ac30403a38089d /src/corelib/tools/qtools_p.h | |
parent | 0bc6c4f7ecfa332de57500fe722872eff4009b9b (diff) |
Merge the different implementations of toHex in one central place
It's a simple enough function, but we don't need to duplicate those 17
bytes all over the place. Now they'll be duplicated at most once per
library.
Change-Id: Ic995e2a934b005e7e996e70f2ee644bfa948eb38
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 | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/src/corelib/tools/qtools_p.h b/src/corelib/tools/qtools_p.h index 1e72db1d87..2acf3427f0 100644 --- a/src/corelib/tools/qtools_p.h +++ b/src/corelib/tools/qtools_p.h @@ -50,6 +50,20 @@ QT_BEGIN_NAMESPACE +namespace QtMiscUtils { +inline char toHexUpper(uint value) +{ + static const char hexdigits[] = "0123456789ABCDEF"; + return hexdigits[value & 0xF]; +} + +inline char toHexLower(uint value) +{ + static const char hexdigits[] = "0123456789abcdef"; + return hexdigits[value & 0xF]; +} +} + // We typically need an extra bit for qNextPowerOfTwo when determining the next allocation size. enum { MaxAllocSize = (1 << (std::numeric_limits<int>::digits - 1)) - 1 |