|
M5Utility 0.0.12 git rev:13bfbd6
|
Endian-compliant integer type. More...
#include <types.hpp>
Public Member Functions | |
| template<bool HostIsLittle = m5::endian::little> | |
| void | set (const T v) |
| Set value with specified endianness. | |
| template<bool HostIsLittle = m5::endian::little> | |
| T | get () const |
| Gets value with specified endianness. | |
| uint8_t | high () const |
| Gets the high byte (u8[0]) | |
| uint8_t | low () const |
| Gets the low byte (u8[sizeof(T)-1]) | |
| const uint8_t * | data () const |
| Gets the const pointer. | |
| uint8_t * | data () |
| Gets the pointer. | |
| size_t | size () const |
| Gets size in uint8_t units. | |
Constructor | |
| constexpr | EndianInt () |
| default constructor | |
| template<bool HostIsLittle = m5::endian::little> | |
| EndianInt (const T v) | |
| from T | |
| template<typename U = T, typename std::enable_if< sizeof(U)==2, int >::type = 0> | |
| constexpr | EndianInt (const uint8_t b0, const uint8_t b1) |
| Stored in order of bytes (2-byte types) | |
| template<typename U = T, typename std::enable_if< sizeof(U)==4, int >::type = 0> | |
| constexpr | EndianInt (const uint8_t b0, const uint8_t b1, const uint8_t b2, const uint8_t b3) |
| Stored in order of bytes (4-byte types) | |
| template<typename U = T, typename std::enable_if< sizeof(U)==8, int >::type = 0> | |
| constexpr | EndianInt (const uint8_t b0, const uint8_t b1, const uint8_t b2, const uint8_t b3, const uint8_t b4, const uint8_t b5, const uint8_t b6, const uint8_t b7) |
| Stored in order of bytes (8-byte types) | |
| constexpr | EndianInt (const EndianInt &)=default |
| default constructor | |
| constexpr | EndianInt (EndianInt &&o) noexcept=default |
| default constructor | |
Assignment | |
| EndianInt & | operator= (const EndianInt &)=default |
| EndianInt & | operator= (EndianInt &&) noexcept=default |
| template<bool HostIsLittle = m5::endian::little> | |
| EndianInt & | operator= (const T v) |
| template<typename H , typename L , typename U = T, typename std::enable_if< sizeof(U)==2, int >::type = 0> | |
| EndianInt & | operator= (const std::pair< H, L > &o) |
Cast | |
| operator bool () const | |
| To boolean. | |
| operator const uint8_t * () const | |
| To const uint8_t*. | |
| operator uint8_t * () | |
| To uint8_t*. | |
| operator T () const | |
| To T on processor endianness. | |
Public Attributes | |
| T | value {} |
| Raw value. | |
| uint8_t | u8 [sizeof(T)] |
| Raw value according to uint8_t. | |
Related Symbols | |
(Note that these are not member symbols.) | |
Compare | |
| template<typename T , bool DL1, bool DL2> | |
| bool | operator== (const EndianInt< T, DL1 > &a, const EndianInt< T, DL2 > &b) |
| template<typename T , bool DL1, bool DL2> | |
| bool | operator!= (const EndianInt< T, DL1 > &a, const EndianInt< T, DL2 > &b) |
| template<typename T , bool DL1, bool DL2> | |
| bool | operator< (const EndianInt< T, DL1 > &a, const EndianInt< T, DL2 > &b) |
| template<typename T , bool DL1, bool DL2> | |
| bool | operator> (const EndianInt< T, DL1 > &a, const EndianInt< T, DL2 > &b) |
| template<typename T , bool DL1, bool DL2> | |
| bool | operator<= (const EndianInt< T, DL1 > &a, const EndianInt< T, DL2 > &b) |
| template<typename T , bool DL1, bool DL2> | |
| bool | operator>= (const EndianInt< T, DL1 > &a, const EndianInt< T, DL2 > &b) |
Endian-compliant integer type.
| T | Underlying integer type (uint16_t, int16_t, uint32_t, int32_t, etc.) |
| DataIsLittle | Data endianness true: Little false: Big |
|
inline |
Gets value with specified endianness.
| HostIsLittle | Host endianness (default as processor endianness) |
|
inline |
Set value with specified endianness.
| HostIsLittle | Host endianness (default as processor endianness) |