![]() |
Embedded Template Library
1.0
|
Classes | |
class | etl::binary_exception |
class | etl::binary_out_of_range |
struct | etl::max_value_for_nbits< NBITS > |
Definition for non-zero NBITS. More... | |
struct | etl::bit< POSITION > |
Enumerations | |
enum | etl::binary_constant { b00000000 = 0 , b00000001 = 1 , b00000010 = 2 , b00000011 = 3 , b00000100 = 4 , b00000101 = 5 , b00000110 = 6 , b00000111 = 7 , b00001000 = 8 , b00001001 = 9 , b00001010 = 10 , b00001011 = 11 , b00001100 = 12 , b00001101 = 13 , b00001110 = 14 , b00001111 = 15 , b00010000 = 16 , b00010001 = 17 , b00010010 = 18 , b00010011 = 19 , b00010100 = 20 , b00010101 = 21 , b00010110 = 22 , b00010111 = 23 , b00011000 = 24 , b00011001 = 25 , b00011010 = 26 , b00011011 = 27 , b00011100 = 28 , b00011101 = 29 , b00011110 = 30 , b00011111 = 31 , b00100000 = 32 , b00100001 = 33 , b00100010 = 34 , b00100011 = 35 , b00100100 = 36 , b00100101 = 37 , b00100110 = 38 , b00100111 = 39 , b00101000 = 40 , b00101001 = 41 , b00101010 = 42 , b00101011 = 43 , b00101100 = 44 , b00101101 = 45 , b00101110 = 46 , b00101111 = 47 , b00110000 = 48 , b00110001 = 49 , b00110010 = 50 , b00110011 = 51 , b00110100 = 52 , b00110101 = 53 , b00110110 = 54 , b00110111 = 55 , b00111000 = 56 , b00111001 = 57 , b00111010 = 58 , b00111011 = 59 , b00111100 = 60 , b00111101 = 61 , b00111110 = 62 , b00111111 = 63 , b01000000 = 64 , b01000001 = 65 , b01000010 = 66 , b01000011 = 67 , b01000100 = 68 , b01000101 = 69 , b01000110 = 70 , b01000111 = 71 , b01001000 = 72 , b01001001 = 73 , b01001010 = 74 , b01001011 = 75 , b01001100 = 76 , b01001101 = 77 , b01001110 = 78 , b01001111 = 79 , b01010000 = 80 , b01010001 = 81 , b01010010 = 82 , b01010011 = 83 , b01010100 = 84 , b01010101 = 85 , b01010110 = 86 , b01010111 = 87 , b01011000 = 88 , b01011001 = 89 , b01011010 = 90 , b01011011 = 91 , b01011100 = 92 , b01011101 = 93 , b01011110 = 94 , b01011111 = 95 , b01100000 = 96 , b01100001 = 97 , b01100010 = 98 , b01100011 = 99 , b01100100 = 100 , b01100101 = 101 , b01100110 = 102 , b01100111 = 103 , b01101000 = 104 , b01101001 = 105 , b01101010 = 106 , b01101011 = 107 , b01101100 = 108 , b01101101 = 109 , b01101110 = 110 , b01101111 = 111 , b01110000 = 112 , b01110001 = 113 , b01110010 = 114 , b01110011 = 115 , b01110100 = 116 , b01110101 = 117 , b01110110 = 118 , b01110111 = 119 , b01111000 = 120 , b01111001 = 121 , b01111010 = 122 , b01111011 = 123 , b01111100 = 124 , b01111101 = 125 , b01111110 = 126 , b01111111 = 127 , b10000000 = 128 , b10000001 = 129 , b10000010 = 130 , b10000011 = 131 , b10000100 = 132 , b10000101 = 133 , b10000110 = 134 , b10000111 = 135 , b10001000 = 136 , b10001001 = 137 , b10001010 = 138 , b10001011 = 139 , b10001100 = 140 , b10001101 = 141 , b10001110 = 142 , b10001111 = 143 , b10010000 = 144 , b10010001 = 145 , b10010010 = 146 , b10010011 = 147 , b10010100 = 148 , b10010101 = 149 , b10010110 = 150 , b10010111 = 151 , b10011000 = 152 , b10011001 = 153 , b10011010 = 154 , b10011011 = 155 , b10011100 = 156 , b10011101 = 157 , b10011110 = 158 , b10011111 = 159 , b10100000 = 160 , b10100001 = 161 , b10100010 = 162 , b10100011 = 163 , b10100100 = 164 , b10100101 = 165 , b10100110 = 166 , b10100111 = 167 , b10101000 = 168 , b10101001 = 169 , b10101010 = 170 , b10101011 = 171 , b10101100 = 172 , b10101101 = 173 , b10101110 = 174 , b10101111 = 175 , b10110000 = 176 , b10110001 = 177 , b10110010 = 178 , b10110011 = 179 , b10110100 = 180 , b10110101 = 181 , b10110110 = 182 , b10110111 = 183 , b10111000 = 184 , b10111001 = 185 , b10111010 = 186 , b10111011 = 187 , b10111100 = 188 , b10111101 = 189 , b10111110 = 190 , b10111111 = 191 , b11000000 = 192 , b11000001 = 193 , b11000010 = 194 , b11000011 = 195 , b11000100 = 196 , b11000101 = 197 , b11000110 = 198 , b11000111 = 199 , b11001000 = 200 , b11001001 = 201 , b11001010 = 202 , b11001011 = 203 , b11001100 = 204 , b11001101 = 205 , b11001110 = 206 , b11001111 = 207 , b11010000 = 208 , b11010001 = 209 , b11010010 = 210 , b11010011 = 211 , b11010100 = 212 , b11010101 = 213 , b11010110 = 214 , b11010111 = 215 , b11011000 = 216 , b11011001 = 217 , b11011010 = 218 , b11011011 = 219 , b11011100 = 220 , b11011101 = 221 , b11011110 = 222 , b11011111 = 223 , b11100000 = 224 , b11100001 = 225 , b11100010 = 226 , b11100011 = 227 , b11100100 = 228 , b11100101 = 229 , b11100110 = 230 , b11100111 = 231 , b11101000 = 232 , b11101001 = 233 , b11101010 = 234 , b11101011 = 235 , b11101100 = 236 , b11101101 = 237 , b11101110 = 238 , b11101111 = 239 , b11110000 = 240 , b11110001 = 241 , b11110010 = 242 , b11110011 = 243 , b11110100 = 244 , b11110101 = 245 , b11110110 = 246 , b11110111 = 247 , b11111000 = 248 , b11111001 = 249 , b11111010 = 250 , b11111011 = 251 , b11111100 = 252 , b11111101 = 253 , b11111110 = 254 , b11111111 = 255 } |
enum | etl::bit_constant { b0 = 0x1 , b1 = 0x2 , b2 = 0x4 , b3 = 0x8 , b4 = 0x10 , b5 = 0x20 , b6 = 0x40 , b7 = 0x80 , b8 = 0x100 , b9 = 0x200 , b10 = 0x400 , b11 = 0x800 , b12 = 0x1000 , b13 = 0x2000 , b14 = 0x4000 , b15 = 0x8000 , b16 = 0x10000 , b17 = 0x20000 , b18 = 0x40000 , b19 = 0x80000 , b20 = 0x100000 , b21 = 0x200000 , b22 = 0x400000 , b23 = 0x800000 , b24 = 0x1000000 , b25 = 0x2000000 , b26 = 0x4000000 , b27 = 0x8000000 , b28 = 0x10000000 , b29 = 0x20000000 , b30 = 0x40000000 , b31 = 0x80000000 } |
Functions | |
template<typename T > | |
ETL_CONSTEXPR14 T | etl::rotate_left (T value) |
template<typename T > | |
ETL_CONSTEXPR14 T | etl::rotate_left (T value, size_t distance) |
template<typename T > | |
ETL_CONSTEXPR14 T | etl::rotate_right (T value) |
template<typename T > | |
ETL_CONSTEXPR14 T | etl::rotate_right (T value, size_t distance) |
template<typename T > | |
ETL_CONSTEXPR14 T | etl::rotate (T value, typename etl::make_signed< size_t >::type distance) |
template<typename T > | |
ETL_CONSTEXPR T | etl::binary_to_gray (T value) |
template<typename TReturn , const size_t NBITS, typename TValue > | |
ETL_CONSTEXPR14 TReturn | etl::fold_bits (TValue value) |
template<typename TReturn , const size_t NBITS, typename TValue > | |
ETL_CONSTEXPR14 TReturn | etl::sign_extend (TValue value) |
template<typename TReturn , const size_t NBITS, const size_t SHIFT, typename TValue > | |
ETL_CONSTEXPR14 TReturn | etl::sign_extend (TValue value) |
template<typename TReturn , typename TValue > | |
ETL_CONSTEXPR14 TReturn | etl::sign_extend (TValue value, const size_t NBITS) |
template<typename TReturn , typename TValue > | |
ETL_CONSTEXPR14 TReturn | etl::sign_extend (TValue value, const size_t NBITS, const size_t SHIFT) |
template<typename T > | |
ETL_CONSTEXPR14 uint_least8_t | etl::first_set_bit_position (T value) |
template<typename T > | |
ETL_CONSTEXPR14 uint_least8_t | etl::first_clear_bit_position (T value) |
template<typename T > | |
ETL_CONSTEXPR14 uint_least8_t | etl::first_bit_position (bool state, T value) |
template<typename TResult , typename TValue > | |
ETL_CONSTEXPR TResult | etl::binary_fill (TValue value) |
template<typename TResult , typename TValue , const TValue N> | |
ETL_CONSTEXPR TResult | etl::binary_fill () |
template<typename T > | |
ETL_CONSTEXPR T | etl::binary_merge (const T first, const T second, const T mask) |
template<typename T , const T MASK> | |
ETL_CONSTEXPR T | etl::binary_merge (const T first, const T second) |
ETL_CONSTEXPR14 uint16_t | etl::reverse_bits (uint16_t value) |
ETL_CONSTEXPR14 uint32_t | etl::reverse_bits (uint32_t value) |
ETL_CONSTEXPR14 uint64_t | etl::reverse_bits (uint64_t value) |
ETL_CONSTEXPR uint16_t | etl::reverse_bytes (uint16_t value) |
ETL_CONSTEXPR14 uint32_t | etl::reverse_bytes (uint32_t value) |
ETL_CONSTEXPR14 uint64_t | etl::reverse_bytes (uint64_t value) |
ETL_CONSTEXPR14 uint16_t | etl::gray_to_binary (uint16_t value) |
ETL_CONSTEXPR14 uint32_t | etl::gray_to_binary (uint32_t value) |
ETL_CONSTEXPR14 uint64_t | etl::gray_to_binary (uint64_t value) |
ETL_CONSTEXPR14 uint_least8_t | etl::count_bits (uint16_t value) |
ETL_CONSTEXPR14 uint_least8_t | etl::count_bits (uint32_t value) |
ETL_CONSTEXPR14 uint_least8_t | etl::count_bits (uint64_t value) |
ETL_CONSTEXPR14 uint_least8_t | etl::parity (uint16_t value) |
ETL_CONSTEXPR14 uint_least8_t | etl::parity (uint32_t value) |
ETL_CONSTEXPR14 uint_least8_t | etl::parity (uint64_t value) |
ETL_CONSTEXPR14 uint_least8_t | etl::count_trailing_zeros (uint16_t value) |
ETL_CONSTEXPR14 uint_least8_t | etl::count_trailing_zeros (uint32_t value) |
ETL_CONSTEXPR14 uint_least8_t | etl::count_trailing_zeros (uint64_t value) |
ETL_CONSTEXPR14 uint32_t | etl::binary_interleave (uint16_t first, uint16_t second) |
ETL_CONSTEXPR14 uint64_t | etl::binary_interleave (uint32_t first, uint32_t second) |
template<typename T > | |
ETL_CONSTEXPR etl::enable_if< etl::is_integral< T >::value, bool >::type | etl::is_odd (const T value) |
template<typename T > | |
ETL_CONSTEXPR etl::enable_if< etl::is_integral< T >::value, bool >::type | etl::is_even (const T value) |
Binary utilities
class etl::binary_exception |
Exception for binary functions.
Public Member Functions | |
binary_exception (string_type reason_, string_type file_name_, numeric_type line_number_) | |
![]() | |
exception (string_type reason_, string_type file_, numeric_type line_) | |
Constructor. | |
string_type | what () const |
string_type | file_name () const |
numeric_type | line_number () const |
Additional Inherited Members | |
![]() | |
typedef const char * | string_type |
typedef int | numeric_type |
class etl::binary_out_of_range |
Full exception 'for out of range' errors.
Public Member Functions | |
binary_out_of_range (string_type file_name_, numeric_type line_number_) | |
![]() | |
binary_exception (string_type reason_, string_type file_name_, numeric_type line_number_) | |
![]() | |
exception (string_type reason_, string_type file_, numeric_type line_) | |
Constructor. | |
string_type | what () const |
string_type | file_name () const |
numeric_type | line_number () const |
Additional Inherited Members | |
![]() | |
typedef const char * | string_type |
typedef int | numeric_type |
struct etl::max_value_for_nbits |
Definition for non-zero NBITS.
Maximum value that can be contained in N bits.
Public Types | |
typedef etl::smallest_uint_for_bits< NBITS >::type | value_type |
Static Public Attributes | |
static const value_type | value = (value_type(1) << (NBITS - 1)) | max_value_for_nbits<NBITS - 1>::value |
struct etl::bit |
Gets the value of the bit at POSITION Starts from LSB.
Public Types | |
typedef etl::smallest_uint_for_bits< POSITION+1 >::type | value_type |
Static Public Attributes | |
static const value_type | value = value_type(1) << POSITION |
enum etl::binary_constant |
8 bit binary byte constants.
enum etl::bit_constant |
Binary bit constants.
ETL_CONSTEXPR TResult etl::binary_fill | ( | ) |
Fills a value with a bit pattern. Partial compile time.
ETL_CONSTEXPR TResult etl::binary_fill | ( | TValue | value | ) |
Fills a value with a bit pattern.
|
inline |
Binary interleave
|
inline |
Binary interleave
ETL_CONSTEXPR T etl::binary_merge | ( | const T | first, |
const T | second | ||
) |
Merges two values according to a mask. Ones in the mask select bits from 'first', zeros select bits from second. Mask is a template parameter.
ETL_CONSTEXPR T etl::binary_merge | ( | const T | first, |
const T | second, | ||
const T | mask | ||
) |
Merges two values according to a mask. Ones in the mask select bits from 'first', zeros select bits from second. Mask is a function parameter.
ETL_CONSTEXPR T etl::binary_to_gray | ( | T | value | ) |
Converts binary to Gray code.
|
inline |
Count set bits. 16 bits.
|
inline |
Count set bits. 32 bits.
|
inline |
Count set bits. 64 bits.
|
inline |
Count trailing zeros. 16bit. Uses a binary search.
|
inline |
Count trailing zeros. 32bit. Uses a binary search.
|
inline |
Count trailing zeros. 64bit. Uses a binary search.
ETL_CONSTEXPR14 uint_least8_t etl::first_bit_position | ( | bool | state, |
T | value | ||
) |
Find the position of the first bit that is clear or set. Starts from LSB.
ETL_CONSTEXPR14 uint_least8_t etl::first_clear_bit_position | ( | T | value | ) |
Find the position of the first clear bit. Starts from LSB.
ETL_CONSTEXPR14 uint_least8_t etl::first_set_bit_position | ( | T | value | ) |
Find the position of the first set bit. Starts from LSB.
ETL_CONSTEXPR14 TReturn etl::fold_bits | ( | TValue | value | ) |
Fold a binary number down to a set number of bits using XOR.
|
inline |
Converts Gray code to binary.
|
inline |
Converts Gray code to binary.
|
inline |
Converts Gray code to binary.
ETL_CONSTEXPR etl::enable_if<etl::is_integral<T>::value, bool>::type etl::is_even | ( | const T | value | ) |
Checks if even.
ETL_CONSTEXPR etl::enable_if<etl::is_integral<T>::value, bool>::type etl::is_odd | ( | const T | value | ) |
Checks if odd.
|
inline |
Parity. 16bits. 0 = even, 1 = odd
|
inline |
Parity. 32bits. 0 = even, 1 = odd
|
inline |
Parity. 64bits. 0 = even, 1 = odd
|
inline |
Reverse 16 bits.
|
inline |
Reverse 32 bits.
|
inline |
Reverse 64 bits.
|
inline |
Reverse bytes 8 bit. Reverse bytes 16 bit.
|
inline |
Reverse bytes 32 bit.
|
inline |
Reverse bytes 64 bit.
ETL_CONSTEXPR14 T etl::rotate | ( | T | value, |
typename etl::make_signed< size_t >::type | distance | ||
) |
Rotate. Positive is left, negative is right.
ETL_CONSTEXPR14 T etl::rotate_left | ( | T | value | ) |
Rotate left.
ETL_CONSTEXPR14 T etl::rotate_left | ( | T | value, |
size_t | distance | ||
) |
Rotate left.
ETL_CONSTEXPR14 T etl::rotate_right | ( | T | value | ) |
Rotate right.
ETL_CONSTEXPR14 T etl::rotate_right | ( | T | value, |
size_t | distance | ||
) |
Rotate right.
ETL_CONSTEXPR14 TReturn etl::sign_extend | ( | TValue | value | ) |
Sign extend. Converts an N bit binary number, where bit N-1 is the sign bit, to a signed integral type.
ETL_CONSTEXPR14 TReturn etl::sign_extend | ( | TValue | value | ) |
Sign extend. Converts an N bit binary number, where bit N-1 is the sign bit, and SHIFT is the right shift amount, to a signed integral type.
ETL_CONSTEXPR14 TReturn etl::sign_extend | ( | TValue | value, |
const size_t | NBITS | ||
) |
Sign extend. Converts an N bit binary number, where bit N-1 is the sign bit, to a signed integral type.
ETL_CONSTEXPR14 TReturn etl::sign_extend | ( | TValue | value, |
const size_t | NBITS, | ||
const size_t | SHIFT | ||
) |
Sign extend. Converts an N bit binary number, where bit N-1 is the sign bit, and SHIFT is the right shift amount, to a signed integral type.