Honeycomb  0.1
Component-Model Framework
Static Public Member Functions | List of all members
honey::BitOpEndian< static_cast< int >(Endian::little)> Struct Template Reference

Specialization for little endian. More...

#include <BitOp.h>

Inheritance diagram for honey::BitOpEndian< static_cast< int >(Endian::little)>:
Inheritance graph
[legend]
Collaboration diagram for honey::BitOpEndian< static_cast< int >(Endian::little)>:
Collaboration graph
[legend]

Static Public Member Functions

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...
 
Number serialization methods

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)
 
- Static Public Member Functions inherited from honey::BitOpCommon
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)
 

Detailed Description

template<>
struct honey::BitOpEndian< static_cast< int >(Endian::little)>

Specialization for little endian.

Member Function Documentation

template<class Int >
static Int honey::BitOpEndian< static_cast< int >(Endian::little)>::bigToPlatform ( const Int  v)
inlinestatic

Convert integer from big endian to platform endian.

template<class T , typename std::enable_if< std::is_integral< T >::value, int >::type = 0>
static T honey::BitOpEndian< static_cast< int >(Endian::little)>::fromPartsBig ( const uint8 p)
inlinestatic

Convert an array of smaller number parts into a full number, where the first index holds the most significant part.

template<class T , typename std::enable_if< std::is_floating_point< T >::value, int >::type = 0>
static T honey::BitOpEndian< static_cast< int >(Endian::little)>::fromPartsBig ( const uint8 p)
inlinestatic
template<class T , typename std::enable_if< std::is_integral< T >::value, int >::type = 0>
static T honey::BitOpEndian< static_cast< int >(Endian::little)>::fromPartsLittle ( const uint8 p)
inlinestatic

Convert an array of smaller number parts into a full number, where the first index holds the least significant part.

template<class T , typename std::enable_if< std::is_floating_point< T >::value, int >::type = 0>
static T honey::BitOpEndian< static_cast< int >(Endian::little)>::fromPartsLittle ( const uint8 p)
inlinestatic
template<class Int >
static Int honey::BitOpEndian< static_cast< int >(Endian::little)>::littleToPlatform ( const Int  v)
inlinestatic

Convert integer from little endian to platform endian.

static Endian honey::BitOpEndian< static_cast< int >(Endian::little)>::platformEndian ( )
inlinestatic

Get platform endian type.

template<class Int >
static Int honey::BitOpEndian< static_cast< int >(Endian::little)>::platformToBig ( const Int  v)
inlinestatic

Convert integer from platform endian to big endian.

template<class Int >
static Int honey::BitOpEndian< static_cast< int >(Endian::little)>::platformToLittle ( const Int  v)
inlinestatic

Convert integer from platform endian to little endian.

template<class T , typename std::enable_if< std::is_integral< T >::value, int >::type = 0>
static void honey::BitOpEndian< static_cast< int >(Endian::little)>::toPartsBig ( const T  v,
uint8 p 
)
inlinestatic

Convert a full number into an array of smaller number parts, where the first index holds the most significant part.

template<class T , typename std::enable_if< std::is_floating_point< T >::value, int >::type = 0>
static void honey::BitOpEndian< static_cast< int >(Endian::little)>::toPartsBig ( const T  v,
uint8 p 
)
inlinestatic
template<class T , typename std::enable_if< std::is_integral< T >::value, int >::type = 0>
static void honey::BitOpEndian< static_cast< int >(Endian::little)>::toPartsLittle ( const T  v,
uint8 p 
)
inlinestatic

Convert a full number into an array of smaller number parts, where the first index holds the least significant part.

template<class T , typename std::enable_if< std::is_floating_point< T >::value, int >::type = 0>
static void honey::BitOpEndian< static_cast< int >(Endian::little)>::toPartsLittle ( const T  v,
uint8 p 
)
inlinestatic

The documentation for this struct was generated from the following file: