Loading...
Searching...
No Matches
binary

## 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 >
struct | etl::reverse_bits_const< T, Value >
struct | etl::binary_not< T >
struct | etl::binary_and< T >
struct | etl::binary_or< T >
struct | etl::binary_xor< T >

## Enumerations

enum

etl::binary_constant {
b00000000 = 0U , b00000001 = 1U , b00000010 = 2U , b00000011 = 3U ,
b00000100 = 4U , b00000101 = 5U , b00000110 = 6U , b00000111 = 7U ,
b00001000 = 8U , b00001001 = 9U , b00001010 = 10U , b00001011 = 11U ,
b00001100 = 12U , b00001101 = 13U , b00001110 = 14U , b00001111 = 15U ,
b00010000 = 16U , b00010001 = 17U , b00010010 = 18U , b00010011 = 19U ,
b00010100 = 20U , b00010101 = 21U , b00010110 = 22U , b00010111 = 23U ,
b00011000 = 24U , b00011001 = 25U , b00011010 = 26U , b00011011 = 27U ,
b00011100 = 28U , b00011101 = 29U , b00011110 = 30U , b00011111 = 31U ,
b00100000 = 32U , b00100001 = 33U , b00100010 = 34U , b00100011 = 35U ,
b00100100 = 36U , b00100101 = 37U , b00100110 = 38U , b00100111 = 39U ,
b00101000 = 40U , b00101001 = 41U , b00101010 = 42U , b00101011 = 43U ,
b00101100 = 44U , b00101101 = 45U , b00101110 = 46U , b00101111 = 47U ,
b00110000 = 48U , b00110001 = 49U , b00110010 = 50U , b00110011 = 51U ,
b00110100 = 52U , b00110101 = 53U , b00110110 = 54U , b00110111 = 55U ,
b00111000 = 56U , b00111001 = 57U , b00111010 = 58U , b00111011 = 59U ,
b00111100 = 60U , b00111101 = 61U , b00111110 = 62U , b00111111 = 63U ,
b01000000 = 64U , b01000001 = 65U , b01000010 = 66U , b01000011 = 67U ,
b01000100 = 68U , b01000101 = 69U , b01000110 = 70U , b01000111 = 71U ,
b01001000 = 72U , b01001001 = 73U , b01001010 = 74U , b01001011 = 75U ,
b01001100 = 76U , b01001101 = 77U , b01001110 = 78U , b01001111 = 79U ,
b01010000 = 80U , b01010001 = 81U , b01010010 = 82U , b01010011 = 83U ,
b01010100 = 84U , b01010101 = 85U , b01010110 = 86U , b01010111 = 87U ,
b01011000 = 88U , b01011001 = 89U , b01011010 = 90U , b01011011 = 91U ,
b01011100 = 92U , b01011101 = 93U , b01011110 = 94U , b01011111 = 95U ,
b01100000 = 96U , b01100001 = 97U , b01100010 = 98U , b01100011 = 99U ,
b01100100 = 100U , b01100101 = 101U , b01100110 = 102U , b01100111 = 103U ,
b01101000 = 104U , b01101001 = 105U , b01101010 = 106U , b01101011 = 107U ,
b01101100 = 108U , b01101101 = 109U , b01101110 = 110U , b01101111 = 111U ,
b01110000 = 112U , b01110001 = 113U , b01110010 = 114U , b01110011 = 115U ,
b01110100 = 116U , b01110101 = 117U , b01110110 = 118U , b01110111 = 119U ,
b01111000 = 120U , b01111001 = 121U , b01111010 = 122U , b01111011 = 123U ,
b01111100 = 124U , b01111101 = 125U , b01111110 = 126U , b01111111 = 127U ,
b10000000 = 128U , b10000001 = 129U , b10000010 = 130U , b10000011 = 131U ,
b10000100 = 132U , b10000101 = 133U , b10000110 = 134U , b10000111 = 135U ,
b10001000 = 136U , b10001001 = 137U , b10001010 = 138U , b10001011 = 139U ,
b10001100 = 140U , b10001101 = 141U , b10001110 = 142U , b10001111 = 143U ,
b10010000 = 144U , b10010001 = 145U , b10010010 = 146U , b10010011 = 147U ,
b10010100 = 148U , b10010101 = 149U , b10010110 = 150U , b10010111 = 151U ,
b10011000 = 152U , b10011001 = 153U , b10011010 = 154U , b10011011 = 155U ,
b10011100 = 156U , b10011101 = 157U , b10011110 = 158U , b10011111 = 159U ,
b10100000 = 160U , b10100001 = 161U , b10100010 = 162U , b10100011 = 163U ,
b10100100 = 164U , b10100101 = 165U , b10100110 = 166U , b10100111 = 167U ,
b10101000 = 168U , b10101001 = 169U , b10101010 = 170U , b10101011 = 171U ,
b10101100 = 172U , b10101101 = 173U , b10101110 = 174U , b10101111 = 175U ,
b10110000 = 176U , b10110001 = 177U , b10110010 = 178U , b10110011 = 179U ,
b10110100 = 180U , b10110101 = 181U , b10110110 = 182U , b10110111 = 183U ,
b10111000 = 184U , b10111001 = 185U , b10111010 = 186U , b10111011 = 187U ,
b10111100 = 188U , b10111101 = 189U , b10111110 = 190U , b10111111 = 191U ,
b11000000 = 192U , b11000001 = 193U , b11000010 = 194U , b11000011 = 195U ,
b11000100 = 196U , b11000101 = 197U , b11000110 = 198U , b11000111 = 199U ,
b11001000 = 200U , b11001001 = 201U , b11001010 = 202U , b11001011 = 203U ,
b11001100 = 204U , b11001101 = 205U , b11001110 = 206U , b11001111 = 207U ,
b11010000 = 208U , b11010001 = 209U , b11010010 = 210U , b11010011 = 211U ,
b11010100 = 212U , b11010101 = 213U , b11010110 = 214U , b11010111 = 215U ,
b11011000 = 216U , b11011001 = 217U , b11011010 = 218U , b11011011 = 219U ,
b11011100 = 220U , b11011101 = 221U , b11011110 = 222U , b11011111 = 223U ,
b11100000 = 224U , b11100001 = 225U , b11100010 = 226U , b11100011 = 227U ,
b11100100 = 228U , b11100101 = 229U , b11100110 = 230U , b11100111 = 231U ,
b11101000 = 232U , b11101001 = 233U , b11101010 = 234U , b11101011 = 235U ,
b11101100 = 236U , b11101101 = 237U , b11101110 = 238U , b11101111 = 239U ,
b11110000 = 240U , b11110001 = 241U , b11110010 = 242U , b11110011 = 243U ,
b11110100 = 244U , b11110101 = 245U , b11110110 = 246U , b11110111 = 247U ,
b11111000 = 248U , b11111001 = 249U , b11111010 = 250U , b11111011 = 251U ,
b11111100 = 252U , b11111101 = 253U , b11111110 = 254U , b11111111 = 255U
}

enum

etl::bit_constant {
b0 = 0x1UL , b1 = 0x2UL , b2 = 0x4UL , b3 = 0x8UL ,
b4 = 0x10UL , b5 = 0x20UL , b6 = 0x40UL , b7 = 0x80UL ,
b8 = 0x100UL , b9 = 0x200UL , b10 = 0x400UL , b11 = 0x800UL ,
b12 = 0x1000UL , b13 = 0x2000UL , b14 = 0x4000UL , b15 = 0x8000UL ,
b16 = 0x10000UL , b17 = 0x20000UL , b18 = 0x40000UL , b19 = 0x80000UL ,
b20 = 0x100000UL , b21 = 0x200000UL , b22 = 0x400000UL , b23 = 0x800000UL ,
b24 = 0x1000000UL , b25 = 0x2000000UL , b26 = 0x4000000UL , b27 = 0x8000000UL ,
b28 = 0x10000000UL , b29 = 0x20000000UL , b30 = 0x40000000UL , b31 = 0x80000000UL
}

## 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, size_t NBits, typename TValue>
ETL_CONSTEXPR14 TReturn | etl::fold_bits (TValue value)
template<typename TReturn, size_t NBits, typename TValue>
ETL_CONSTEXPR14 TReturn | etl::sign_extend (TValue value)
template<typename TReturn, size_t NBits, 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, size_t NBits)
template<typename TReturn, typename TValue>
ETL_CONSTEXPR14 TReturn | etl::sign_extend (TValue value, size_t NBits, size_t SHIFT)
template<typename TResult, typename TValue>
ETL_CONSTEXPR TResult | etl::binary_fill (TValue value)
template<typename TResult, typename TValue, TValue Value>
ETL_CONSTEXPR TResult | etl::binary_fill ()
template<typename T>
ETL_CONSTEXPR T | etl::binary_merge (T first, T second, T mask)
template<typename T, T MASK>
ETL_CONSTEXPR T | etl::binary_merge (T first, T second)
template<typename T>
ETL_CONSTEXPR14 etl::enable_if< etl::is_integral< T >::value &&etl::is_unsigned< T >::value &&(etl::integral_limits< T >::bits==16U), T >::type | etl::reverse_bits (T value)
template<typename T>
ETL_CONSTEXPR14 etl::enable_if< etl::is_integral< T >::value &&etl::is_unsigned< T >::value &&(etl::integral_limits< T >::bits==16U), T >::type | etl::reverse_bytes (T value)
template<typename T>
ETL_CONSTEXPR14 etl::enable_if< etl::is_integral< T >::value &&etl::is_unsigned< T >::value &&(etl::integral_limits< T >::bits==16U), T >::type | etl::gray_to_binary (T value)
template<typename T>
ETL_CONSTEXPR14 etl::enable_if< etl::is_integral< T >::value &&etl::is_unsigned< T >::value &&(etl::integral_limits< T >::bits==16U), uint_least8_t >::type | etl::count_bits (T value)
template<typename T>
ETL_CONSTEXPR14 etl::enable_if< etl::is_integral< T >::value &&etl::is_unsigned< T >::value &&(etl::integral_limits< T >::bits==16U), uint_least8_t >::type | etl::parity (T value)
template<typename T>
ETL_CONSTEXPR14 etl::enable_if< etl::is_integral< T >::value &&etl::is_unsigned< T >::value &&(etl::integral_limits< T >::bits==16U), uint_least8_t >::type | etl::count_trailing_zeros (T value)
template<typename T>
ETL_CONSTEXPR14 etl::enable_if< etl::is_integral< T >::value &&etl::is_unsigned< T >::value &&(etl::integral_limits< T >::bits==16U), uint_least8_t >::type | etl::count_trailing_ones (T value)
template<typename T>
ETL_CONSTEXPR14 etl::enable_if< etl::is_integral< T >::value &&etl::is_unsigned< T >::value &&(etl::integral_limits< T >::bits==16U), uint_least8_t >::type | etl::count_leading_zeros (T value)
template<typename T>
ETL_CONSTEXPR14 etl::enable_if< etl::is_integral< T >::value &&etl::is_unsigned< T >::value &&(etl::integral_limits< T >::bits==16U), uint_least8_t >::type | etl::count_leading_ones (T value)
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 T>
ETL_CONSTEXPR14 etl::enable_if< etl::is_integral< T >::value &&etl::is_unsigned< T >::value &&(etl::integral_limits< T >::bits==16U), uint32_t >::type | etl::binary_interleave (T first, T second)
template<typename T>
ETL_CONSTEXPR etl::enable_if< etl::is_integral< T >::value, bool >::type | etl::is_odd (T value)
template<typename T>
ETL_CONSTEXPR etl::enable_if< etl::is_integral< T >::value, bool >::type | etl::is_even (T value)

## Detailed Description

Binary utilities

## Class Documentation

## etl::binary_exception

class etl::binary_exception

Exception for binary functions.

### Public Member Functions

| binary_exception (string_type reason_, string_type file_name_, numeric_type line_number_)
Public Member Functions inherited from etl::exception
ETL_EXCEPTION_CONSTEXPR | exception (string_type reason_, string_type, numeric_type)
| Constructor.
ETL_EXCEPTION_CONSTEXPR string_type | what () const ETL_NOEXCEPT ETL_EXCEPTION_OVERRIDE
ETL_EXCEPTION_CONSTEXPR string_type | file_name () const
ETL_EXCEPTION_CONSTEXPR numeric_type | line_number () const

## Additional Inherited Members

Public Types inherited from etl::exception
typedef const char * | string_type
typedef int | numeric_type

## etl::binary_out_of_range

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_)
Public Member Functions inherited from etl::binary_exception
| binary_exception (string_type reason_, string_type file_name_, numeric_type line_number_)
Public Member Functions inherited from etl::exception
ETL_EXCEPTION_CONSTEXPR | exception (string_type reason_, string_type, numeric_type)
| Constructor.
ETL_EXCEPTION_CONSTEXPR string_type | what () const ETL_NOEXCEPT ETL_EXCEPTION_OVERRIDE
ETL_EXCEPTION_CONSTEXPR string_type | file_name () const
ETL_EXCEPTION_CONSTEXPR numeric_type | line_number () const

## Additional Inherited Members

Public Types inherited from etl::exception
typedef const char * | string_type
typedef int | numeric_type

## etl::max_value_for_nbits

struct etl::max_value_for_nbits

template<size_t NBits>
struct etl::max_value_for_nbits< 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 ETL_CONSTANT value_type | value = (value_type(1) << (NBits - 1)) | max_value_for_nbits<NBits - 1>::value

## etl::bit

struct etl::bit

template<size_t POSITION>
struct etl::bit< POSITION >

Gets the value of the bit at POSITION Starts from LSB.

### Public Types

typedef etl::smallest_uint_for_bits< POSITION+1U >::type | value_type

### Static Public Attributes

static ETL_CONSTANT value_type | value = value_type(1) << POSITION

## etl::reverse_bits_const

struct etl::reverse_bits_const

template<typename T, T Value>
struct etl::reverse_bits_const< T, Value >

Reverse bits.

## etl::binary_not

struct etl::binary_not

template<typename T>
struct etl::binary_not< T >

Bit 'not' a value

### Public Member Functions

ETL_NODISCARD ETL_CONSTEXPR T | operator() (T value) const ETL_NOEXCEPT

## Additional Inherited Members

Public Types inherited from etl::unary_function< T, T >
typedef T | argument_type
typedef T | result_type

## etl::binary_and

struct etl::binary_and

template<typename T>
struct etl::binary_and< T >

Bit 'and' a value with another

### Public Member Functions

ETL_CONSTEXPR | binary_and (T parameter_) ETL_NOEXCEPT
ETL_NODISCARD ETL_CONSTEXPR T | operator() (T value) const ETL_NOEXCEPT

## Additional Inherited Members

Public Types inherited from etl::unary_function< T, T >
typedef T | argument_type
typedef T | result_type

## etl::binary_or

struct etl::binary_or

template<typename T>
struct etl::binary_or< T >

Bit 'or' a value with another

### Public Member Functions

ETL_CONSTEXPR | binary_or (T parameter_) ETL_NOEXCEPT
ETL_NODISCARD ETL_CONSTEXPR T | operator() (T value) const ETL_NOEXCEPT

## Additional Inherited Members

Public Types inherited from etl::unary_function< T, T >
typedef T | argument_type
typedef T | result_type

## etl::binary_xor

struct etl::binary_xor

template<typename T>
struct etl::binary_xor< T >

Bit 'exclusive-or' a value with another

### Public Member Functions

ETL_CONSTEXPR | binary_xor (T parameter_) ETL_NOEXCEPT
ETL_NODISCARD ETL_CONSTEXPR T | operator() (T value) const ETL_NOEXCEPT

## Additional Inherited Members

Public Types inherited from etl::unary_function< T, T >
typedef T | argument_type
typedef T | result_type

## Enumeration Type Documentation

## binary_constant

enum etl::binary_constant

8 bit binary byte constants.

## bit_constant

enum etl::bit_constant

Binary bit constants.

## Function Documentation

## binary_fill() [1/2]

template<typename TResult, typename TValue, TValue Value>

ETL_CONSTEXPR TResult etl::binary_fill | ( |  | ) |

Fills a value with a bit pattern. Partial compile time.

## binary_fill() [2/2]

template<typename TResult, typename TValue>

ETL_CONSTEXPR TResult etl::binary_fill | ( | TValue | value | ) |

Fills a value with a bit pattern.

## binary_interleave()

template<typename T>

ETL_CONSTEXPR14 etl::enable_if< etl::is_integral< T >::value &&etl::is_unsigned< T >::value &&(etl::integral_limits< T >::bits==16U), uint32_t >::type etl::binary_interleave | ( | T | first,
|  | T | second )

Binary interleave

## binary_merge() [1/2]

template<typename T, T MASK>

ETL_CONSTEXPR T etl::binary_merge | ( | T | first,
|  | 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.

## binary_merge() [2/2]

template<typename T>

ETL_CONSTEXPR T etl::binary_merge | ( | T | first,
|  | T | second,
|  | 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.

## binary_to_gray()

template<typename T>

ETL_CONSTEXPR T etl::binary_to_gray | ( | T | value | ) |

Converts binary to Gray code.

## count_bits()

template<typename T>

ETL_CONSTEXPR14 etl::enable_if< etl::is_integral< T >::value &&etl::is_unsigned< T >::value &&(etl::integral_limits< T >::bits==16U), uint_least8_t >::type etl::count_bits | ( | T | value | ) |

Count set bits. 16 bits.

## count_leading_ones()

template<typename T>

ETL_CONSTEXPR14 etl::enable_if< etl::is_integral< T >::value &&etl::is_unsigned< T >::value &&(etl::integral_limits< T >::bits==16U), uint_least8_t >::type etl::count_leading_ones | ( | T | value | ) |

Count leading ones. Uses a binary search.

## count_leading_zeros()

template<typename T>

ETL_CONSTEXPR14 etl::enable_if< etl::is_integral< T >::value &&etl::is_unsigned< T >::value &&(etl::integral_limits< T >::bits==16U), uint_least8_t >::type etl::count_leading_zeros | ( | T | value | ) |

Count leading zeros. Uses a binary search.

## count_trailing_ones()

template<typename T>

ETL_CONSTEXPR14 etl::enable_if< etl::is_integral< T >::value &&etl::is_unsigned< T >::value &&(etl::integral_limits< T >::bits==16U), uint_least8_t >::type etl::count_trailing_ones | ( | T | value | ) |

Count trailing zeros. 16bit. Uses a binary search.

## count_trailing_zeros()

template<typename T>

ETL_CONSTEXPR14 etl::enable_if< etl::is_integral< T >::value &&etl::is_unsigned< T >::value &&(etl::integral_limits< T >::bits==16U), uint_least8_t >::type etl::count_trailing_zeros | ( | T | value | ) |

Count trailing zeros. 16bit. Uses a binary search.

## first_bit_position()

template<typename T>

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.

## first_clear_bit_position()

template<typename T>

ETL_CONSTEXPR14 uint_least8_t etl::first_clear_bit_position | ( | T | value | ) |

Find the position of the first clear bit. Starts from LSB.

## first_set_bit_position()

template<typename T>

ETL_CONSTEXPR14 uint_least8_t etl::first_set_bit_position | ( | T | value | ) |

Find the position of the first set bit. Starts from LSB.

## fold_bits()

template<typename TReturn, size_t NBits, typename TValue>

ETL_CONSTEXPR14 TReturn etl::fold_bits | ( | TValue | value | ) |

Fold a binary number down to a set number of bits using XOR.

## gray_to_binary()

template<typename T>

ETL_CONSTEXPR14 etl::enable_if< etl::is_integral< T >::value &&etl::is_unsigned< T >::value &&(etl::integral_limits< T >::bits==16U), T >::type etl::gray_to_binary | ( | T | value | ) |

Converts Gray code to binary.

## is_even()

template<typename T>

ETL_CONSTEXPR etl::enable_if< etl::is_integral< T >::value, bool >::type etl::is_even | ( | T | value | ) |

Checks if even.

## is_odd()

template<typename T>

ETL_CONSTEXPR etl::enable_if< etl::is_integral< T >::value, bool >::type etl::is_odd | ( | T | value | ) |

Checks if odd.

## parity()

template<typename T>

ETL_CONSTEXPR14 etl::enable_if< etl::is_integral< T >::value &&etl::is_unsigned< T >::value &&(etl::integral_limits< T >::bits==16U), uint_least8_t >::type etl::parity | ( | T | value | ) |

Parity. 16bits. 0 = even, 1 = odd

## reverse_bits()

template<typename T>

ETL_CONSTEXPR14 etl::enable_if< etl::is_integral< T >::value &&etl::is_unsigned< T >::value &&(etl::integral_limits< T >::bits==16U), T >::type etl::reverse_bits | ( | T | value | ) |

Reverse 16 bits.

## reverse_bytes()

template<typename T>

ETL_CONSTEXPR14 etl::enable_if< etl::is_integral< T >::value &&etl::is_unsigned< T >::value &&(etl::integral_limits< T >::bits==16U), T >::type etl::reverse_bytes | ( | T | value | ) |

Reverse bytes 8 bit. Reverse bytes 16 bit.

## rotate()

template<typename T>

ETL_CONSTEXPR14 T etl::rotate | ( | T | value,
|  | typename etl::make_signed< size_t >::type | distance )

Rotate. Positive is left, negative is right.

## rotate_left() [1/2]

template<typename T>

ETL_CONSTEXPR14 T etl::rotate_left | ( | T | value | ) |

Rotate left.

## rotate_left() [2/2]

template<typename T>

ETL_CONSTEXPR14 T etl::rotate_left | ( | T | value,
|  | size_t | distance )

Rotate left.

## rotate_right() [1/2]

template<typename T>

ETL_CONSTEXPR14 T etl::rotate_right | ( | T | value | ) |

Rotate right.

## rotate_right() [2/2]

template<typename T>

ETL_CONSTEXPR14 T etl::rotate_right | ( | T | value,
|  | size_t | distance )

Rotate right.

## sign_extend() [1/4]

template<typename TReturn, size_t NBits, size_t SHIFT, typename TValue>

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.

## sign_extend() [2/4]

template<typename TReturn, size_t NBits, typename TValue>

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.

## sign_extend() [3/4]

template<typename TReturn, typename TValue>

ETL_CONSTEXPR14 TReturn etl::sign_extend | ( | TValue | value,
|  | size_t | NBits )

Sign extend. Converts an N bit binary number, where bit N-1 is the sign bit, to a signed integral type.

## sign_extend() [4/4]

template<typename TReturn, typename TValue>

ETL_CONSTEXPR14 TReturn etl::sign_extend | ( | TValue | value,
|  | size_t | NBits,
|  | 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.