QtMiscUtils: add to/fromOct

...mirroring to/fromHex.

Change-Id: Ie06bd3cc636b0afbc97606eadb8980079a7677a3
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
bb10
Marc Mutz 2015-01-23 21:22:16 +01:00
parent 26d94c1ca7
commit 575029f09b
1 changed files with 10 additions and 0 deletions

View File

@ -70,6 +70,16 @@ Q_DECL_CONSTEXPR inline int fromHex(uint c) Q_DECL_NOTHROW
((c >= 'a') && (c <= 'f')) ? c - 'a' + 10 :
/* otherwise */ -1;
}
Q_DECL_CONSTEXPR inline char toOct(uint value) Q_DECL_NOTHROW
{
return '0' + char(value & 0x7);
}
Q_DECL_CONSTEXPR inline int fromOct(uint c) Q_DECL_NOTHROW
{
return ((c >= '0') && (c <= '7')) ? c - '0' : -1;
}
}
// We typically need an extra bit for qNextPowerOfTwo when determining the next allocation size.