|
static Endian | platformEndian () |
| Get platform endian type. More...
|
|
template<class Int > |
static Int | littleToPlatform (const Int v) |
| Convert integer from little endian to platform endian. More...
|
|
template<class Int > |
static Int | platformToLittle (const Int v) |
| Convert integer from platform endian to little endian. More...
|
|
template<class Int > |
static Int | bigToPlatform (const Int v) |
| Convert integer from big endian to platform endian. More...
|
|
template<class Int > |
static Int | platformToBig (const Int v) |
| Convert integer from platform endian to big endian. More...
|
|
|
These methods can be used to serialize numbers in a platform-endian-agnostic manner (works on any machine).
|
template<class T , typename std::enable_if< std::is_integral< T >::value, int >::type = 0> |
static T | fromPartsLittle (const uint8 *p) |
| Convert an array of smaller number parts into a full number, where the first index holds the least significant part. More...
|
|
template<class T , typename std::enable_if< std::is_floating_point< T >::value, int >::type = 0> |
static T | fromPartsLittle (const uint8 *p) |
|
template<class T , typename std::enable_if< std::is_integral< T >::value, int >::type = 0> |
static T | fromPartsBig (const uint8 *p) |
| Convert an array of smaller number parts into a full number, where the first index holds the most significant part. More...
|
|
template<class T , typename std::enable_if< std::is_floating_point< T >::value, int >::type = 0> |
static T | fromPartsBig (const uint8 *p) |
|
template<class T , typename std::enable_if< std::is_integral< T >::value, int >::type = 0> |
static void | toPartsLittle (const T v, uint8 *p) |
| Convert a full number into an array of smaller number parts, where the first index holds the least significant part. More...
|
|
template<class T , typename std::enable_if< std::is_floating_point< T >::value, int >::type = 0> |
static void | toPartsLittle (const T v, uint8 *p) |
|
template<class T , typename std::enable_if< std::is_integral< T >::value, int >::type = 0> |
static void | toPartsBig (const T v, uint8 *p) |
| Convert a full number into an array of smaller number parts, where the first index holds the most significant part. More...
|
|
template<class T , typename std::enable_if< std::is_floating_point< T >::value, int >::type = 0> |
static void | toPartsBig (const T v, uint8 *p) |
|
template<class T > |
static T | rotLeft (const T v, const int n) |
| Rotate integer bits cyclically to the left. More...
|
|
template<class T > |
static T | rotRight (const T v, const int n) |
| Rotate integer bits cyclically to the right. More...
|
|
static uint8 | swap (const uint8 v) |
| Reverse order of bytes in an unsigned integer. More...
|
|
static uint16 | swap (const uint16 v) |
|
static uint32 | swap (const uint32 v) |
|
static uint64 | swap (const uint64 v) |
|
template<class T > |
static T | swap (const T v) |
| Reverse order of bytes in a signed integer. More...
|
|
static uint8 | high (const uint16 v) |
| Retrieve high bytes from integer. More...
|
|
static uint16 | high (const uint32 v) |
|
static uint32 | high (const uint64 v) |
|
static uint8 | low (const uint16 v) |
| Retrieve low bytes from integer. More...
|
|
static uint16 | low (const uint32 v) |
|
static uint32 | low (const uint64 v) |
|
static uint32 | fromParts (const uint16 hi, const uint16 lo) |
| Convert smaller integer parts into a full integer. More...
|
|
static uint64 | fromParts (const uint32 hi, const uint32 lo) |
|
template<class UInt > |
static UInt | fromPartsLittle (const uint8 *p) |
|
template<class UInt > |
static UInt | fromPartsBig (const uint8 *p) |
|
template<class UInt > |
static void | toPartsLittle (const UInt v, uint8 *p) |
|
template<class UInt > |
static void | toPartsBig (const UInt v, uint8 *p) |
|
static int | popCount (uint32 x) |
| Get number of non-zero bits in unsigned integer. More...
|
|
static int | popCount (uint64 x) |
|
template<class UInt > |
static bool | isPow2 (UInt x) |
| Check if unsigned integer is a power of two. More...
|
|
template<class UInt > |
static UInt | pow2Floor (UInt x) |
| Calc nearest power of two <= unsigned integer. More...
|
|
static uint32 | pow2Ceil (uint32 x) |
| Calc nearest power of two >= unsigned integer. More...
|
|
static uint64 | pow2Ceil (uint64 x) |
|
static int | log2Floor (uint32 x) |
| Calc log base 2 of unsigned integer, rounded down to nearest integer. Returns -1 if x is zero. More...
|
|
static int | log2Floor (uint64 x) |
|
static int | log2Ceil (uint32 x) |
| Calc log base 2 of unsigned integer, rounded up to nearest integer. Returns -1 if x is zero. More...
|
|
static int | log2Ceil (uint64 x) |
|
static uint8 | reverse (uint8 v) |
| Reverse order of bits in an unsigned integer. More...
|
|
static uint16 | reverse (uint16 v) |
|
static uint32 | reverse (uint32 v) |
|
static uint64 | reverse (uint64 v) |
|
template<>
struct honey::BitOpEndian< static_cast< int >(Endian::little)>
Specialization for little endian.