|
CoreComponents 4.0.0
A Modern C++ Toolkit
|
Bit coding and byte order More...
Classes | |
| class | Bit< T, j, i > |
| Select the bits i to j from a word of type T. More... | |
| class | Base64 |
| Base64 codec. More... | |
| class | Binary< byteOrder > |
| Read and write binary data structures. More... | |
| class | BitSink |
| Bit-wise write to a ByteSink. More... | |
| class | BitSource |
| Read from a ByteSource bit-vise. More... | |
Typedefs | |
| using | uint8_t = std::uint8_t |
| 8 bit unsigned word | |
| using | uint16_t = std::uint16_t |
| 16 bit unsigned word | |
| using | uint32_t = std::uint32_t |
| 32 bit unsigned word | |
| using | uint64_t = std::uint64_t |
| 64 bit unsigned word | |
| using | int8_t = std::int8_t |
| 8 bit signed word | |
| using | int16_t = std::int16_t |
| 16 bit signed word | |
| using | int32_t = std::int32_t |
| 32 bit signed word | |
| using | int64_t = std::int64_t |
| 64 bit signed word | |
Enumerations | |
| enum class | ByteOrder { LittleEndian = 1 , BigEndian = 0 } |
| Byte order. More... | |
Functions | |
| template<class B, class A> | |
| B | union_cast (A a) |
| Optimization safe raw type casting. | |
| ByteOrder | localEndian () |
| Return the current system byte order | |
| template<class T> | |
| T | byteSwap (T x) |
| Swap endianess of x. | |
| template<class T> | |
| T | endianGate (T x, const ByteOrder channelByteOrder=ByteOrder::BigEndian) |
| Swap endianess of x from channelByteOrder to system byte order. | |
| template<unsigned j, unsigned i = j, class T, class V> | |
| void | bitAssign (T &word, V newValue) |
| Access bits i to j in word. | |
| template<class T> | |
| T | bitmask (unsigned n) |
| Get bitmask of n bits. | |
| template<class T> | |
| T | bit (unsigned j, unsigned i, const T &word) |
| Get bits i to j in word. | |
| template<unsigned j, unsigned i = j, class T> | |
| T | bit (const T &word) |
| Get bits i to j in word. | |
Bit coding and byte order
| using uint8_t = std::uint8_t |
8 bit unsigned word
| using uint16_t = std::uint16_t |
16 bit unsigned word
| using uint32_t = std::uint32_t |
32 bit unsigned word
| using uint64_t = std::uint64_t |
64 bit unsigned word
| using int8_t = std::int8_t |
8 bit signed word
| using int16_t = std::int16_t |
16 bit signed word
| using int32_t = std::int32_t |
32 bit signed word
| using int64_t = std::int64_t |
64 bit signed word
|
strong |
Byte order.
| Enumerator | |
|---|---|
| LittleEndian | Low order byte precedes the high order byte. |
| BigEndian | High order byte precedes the low order byte. |
| B union_cast | ( | A | a | ) |
Optimization safe raw type casting.
| ByteOrder localEndian | ( | ) |
Return the current system byte order
| T byteSwap | ( | T | x | ) |
Swap endianess of x.
| T endianGate | ( | T | x, |
| const ByteOrder | channelByteOrder = ByteOrder::BigEndian ) |
Swap endianess of x from channelByteOrder to system byte order.
| T | Unsigned integer type |
| void bitAssign | ( | T & | word, |
| V | newValue ) |
Access bits i to j in word.
| T bitmask | ( | unsigned | n | ) |
Get bitmask of n bits.
| T bit | ( | unsigned | j, |
| unsigned | i, | ||
| const T & | word ) |
Get bits i to j in word.
| T bit | ( | const T & | word | ) |
Get bits i to j in word.