26#ifndef ETL_BIT_STREAM_INCLUDED
27#define ETL_BIT_STREAM_INCLUDED
80 typedef const unsigned char* const_iterator;
96 : pdata(reinterpret_cast<unsigned char*>(begin_))
97 , length_chars(static_cast<size_t>(
etl::distance(reinterpret_cast<unsigned char*>(begin_), reinterpret_cast<unsigned char*>(end_))))
106 : pdata(reinterpret_cast<unsigned char*>(begin_))
107 , length_chars(length_)
117 pdata =
reinterpret_cast<unsigned char*
>(begin_);
118 length_chars = length_;
127 set_stream(begin_,
static_cast<size_t>(etl::distance(
reinterpret_cast<unsigned char*
>(begin_),
reinterpret_cast<unsigned char*
>(end_))));
135 bits_available_in_char = CHAR_BIT;
137 bits_available = CHAR_BIT * length_chars;
145 return (bits_available == 0U);
153 bool success =
false;
155 if (pdata != ETL_NULLPTR)
157 if (bits_available > 0)
159 unsigned char chunk = value ? 1 : 0;
160 put_integral(uint32_t(chunk), 1);
171 template <
typename T>
172 typename etl::enable_if<etl::is_integral<T>::value,
bool>
::type put(T value, uint_least8_t nbits = CHAR_BIT *
sizeof(T))
174 return put_integral(
static_cast<uint32_t
>(value), nbits);
177#if ETL_USING_64BIT_TYPES
181 bool put(int64_t value, uint_least8_t nbits = CHAR_BIT *
sizeof(int64_t))
183 return put_integral(uint64_t(value), nbits);
189 bool put(uint64_t value, uint_least8_t nbits = CHAR_BIT *
sizeof(uint64_t))
191 return put_integral(value, nbits);
198 template <
typename T>
199 typename etl::enable_if<etl::is_floating_point<T>::value,
bool>
::type put(T value)
203 unsigned char data[
sizeof(T)];
204 to_bytes(value,
data);
206 for (
size_t i = 0UL; i <
sizeof(T); ++i)
208 if (!put_integral(uint32_t(
data[i]), CHAR_BIT))
222 bool success =
false;
224 if (pdata != ETL_NULLPTR)
227 if (bits_available > 0U)
240 template <
typename T>
241 typename etl::enable_if<etl::is_integral<T>::value,
bool>
::type get(T& value, uint_least8_t nbits = CHAR_BIT *
sizeof(T))
243 bool success =
false;
244 uint_least8_t
bits = nbits;
246 if (pdata != ETL_NULLPTR)
249 if (bits_available >= nbits)
256 unsigned char mask_width =
static_cast<unsigned char>(etl::min(nbits, bits_available_in_char));
258 typedef typename etl::make_unsigned<T>::type chunk_t;
259 chunk_t chunk = get_chunk(mask_width);
262 value |=
static_cast<T
>(chunk << nbits);
270 if (etl::is_signed<T>::value && (
bits != (CHAR_BIT *
sizeof(T))))
272 typedef typename etl::make_signed<T>::type ST;
282 template <
typename T>
283 typename etl::enable_if<etl::is_floating_point<T>::value,
bool>
::type get(T& value)
285 bool success =
false;
287 if (pdata != ETL_NULLPTR)
289 uint_least8_t nbits = CHAR_BIT *
sizeof(T);
292 if (bits_available >= nbits)
297 for (
size_t i = 0UL; i <
sizeof(T); ++i)
302 from_bytes(
reinterpret_cast<const unsigned char*
>(
data.raw), value);
316 size_t s = char_index;
319 if (bits_available_in_char != CHAR_BIT)
332 return (length_chars * CHAR_BIT) - bits_available;
346 const_iterator
end()
const
348 return pdata +
size();
356 bool put_integral(uint32_t value, uint_least8_t nbits)
358 bool success =
false;
360 if (pdata != ETL_NULLPTR)
363 if (bits_available >= nbits)
368 unsigned char mask_width =
static_cast<unsigned char>(etl::min(nbits, bits_available_in_char));
370 uint32_t mask = ((1U << mask_width) - 1U) << nbits;
376 uint32_t chunk = ((value & mask) >> nbits) << (bits_available_in_char - mask_width);
378 put_chunk(
static_cast<unsigned char>(chunk), mask_width);
388#if ETL_USING_64BIT_TYPES
392 bool put_integral(uint64_t value, uint_least8_t nbits)
394 bool success =
false;
396 if (pdata != ETL_NULLPTR)
399 if (bits_available >= nbits)
404 unsigned char mask_width =
static_cast<unsigned char>(etl::min(nbits, bits_available_in_char));
406 uint64_t mask = ((uint64_t(1U) << mask_width) - 1U) << nbits;
411 uint64_t chunk = ((value & mask) >> nbits) << (bits_available_in_char - mask_width);
413 put_chunk(
static_cast<unsigned char>(chunk), mask_width);
427 void put_chunk(
unsigned char chunk,
unsigned char nbits)
430 if (bits_available_in_char == 8U)
432 pdata[char_index] = 0U;
435 pdata[char_index] |= chunk;
442 unsigned char get_chunk(
unsigned char nbits)
444 unsigned char value =
static_cast<unsigned char>(pdata[char_index]);
446 value >>= (bits_available_in_char - nbits);
450 if (nbits == CHAR_BIT)
452 mask = etl::integral_limits<unsigned char>::max;
456 mask =
static_cast<unsigned char>((1U << nbits) - 1);
471 bool result = (
static_cast<unsigned char>(pdata[char_index]) & (1U << (bits_available_in_char - 1U))) != 0U;
481 template <
typename T>
482 void from_bytes(
const unsigned char*
data, T& value)
484 etl::uninitialized_buffer_of<T, 1U> temp;
487 if (etl::endianness::value() == etl::endian::little)
489 etl::reverse_copy(
data,
data +
sizeof(T),
reinterpret_cast<unsigned char*
>(temp.raw));
493 etl::copy(
data,
data +
sizeof(T),
reinterpret_cast<unsigned char*
>(temp.raw));
496 value = *
reinterpret_cast<T*
>(temp.raw);
502 template <
typename T>
503 void to_bytes(T value,
unsigned char*
data)
505 unsigned char* pf =
reinterpret_cast<unsigned char*
>(&value);
508 if (etl::endianness::value() == etl::endian::little)
510 etl::reverse_copy(pf, pf +
sizeof(T),
data);
514 etl::copy(pf, pf +
sizeof(T),
data);
522 void step(
unsigned char nbits)
524 bits_available_in_char -= nbits;
526 if (bits_available_in_char == 0)
529 bits_available_in_char = 8;
532 bits_available -= nbits;
535 unsigned char* pdata;
537 unsigned char bits_available_in_char;
540 size_t bits_available;
551 typedef char value_type;
552 typedef value_type* iterator;
553 typedef const value_type* const_iterator;
555 typedef etl::delegate<void(callback_parameter_type)> callback_type;
560 template <
size_t Length>
563 : pdata(span_.
begin())
565 , bit_order(bit_order_)
566 , byte_order(byte_order_)
567 , callback(callback_)
575 template <
size_t Length>
578 : pdata(reinterpret_cast<char*>(span_.
begin()))
580 , bit_order(bit_order_)
581 , byte_order(byte_order_)
582 , callback(callback_)
592 : pdata(reinterpret_cast<char*>(begin_))
593 , length_chars(static_cast<size_t>(
etl::distance(reinterpret_cast<unsigned char*>(begin_), reinterpret_cast<unsigned char*>(end_))))
594 , bit_order(bit_order_)
595 , byte_order(byte_order_)
596 , callback(callback_)
606 : pdata(reinterpret_cast<char*>(begin_))
607 , length_chars(length_chars_)
608 , bit_order(bit_order_)
609 , byte_order(byte_order_)
610 , callback(callback_)
620 bits_available_in_char = CHAR_BIT;
638 return length_chars * CHAR_BIT;
662 unsigned char chunk = value ? 1 : 0;
663 write_data<unsigned char>(chunk, 1);
684 template <
typename T>
685 typename etl::enable_if<etl::is_integral<T>::value,
void>
::type write_unchecked(T value, uint_least8_t nbits = CHAR_BIT *
sizeof(T))
687 typedef typename etl::unsigned_type<T>::type unsigned_t;
689 write_data<unsigned_t>(
static_cast<unsigned_t
>(value), nbits);
695 template <
typename T>
696 typename etl::enable_if<etl::is_integral<T>::value,
bool>
::type write(T value, uint_least8_t nbits = CHAR_BIT *
sizeof(T))
719 while (nbits > bits_available_in_char)
721 step(bits_available_in_char);
722 nbits -= bits_available_in_char;
727 step(
static_cast<unsigned char>(nbits));
739 size_t s = char_index;
742 if (bits_available_in_char != CHAR_BIT)
762 template <
size_t Nbits>
765 return bits_available / Nbits;
772 template <
typename T>
784 return bits_available / nbits;
792 return bits_available;
830 const_iterator
end()
const
880 if (callback.is_valid())
882 if (bits_available_in_char != 0U)
897 callback = callback_;
914 template <
typename T>
915 void write_data(T value, uint_least8_t nbits)
917 ETL_ASSERT(nbits <= (CHAR_BIT *
sizeof(T)), ETL_ERROR_GENERIC(
"bit_stream_writer::write_data: nbits too large"));
921 if ((byte_order == etl::endian::little) && (nbits == (CHAR_BIT *
sizeof(T))))
930 value = value >> ((CHAR_BIT *
sizeof(T)) - nbits);
936 unsigned char mask_width =
static_cast<unsigned char>(etl::min(nbits, bits_available_in_char));
938 T mask = ((T(1U) << mask_width) - 1U) << nbits;
943 T chunk = ((value & mask) >> nbits) << (bits_available_in_char - mask_width);
945 write_chunk(
static_cast<char>(chunk), mask_width);
948 if (callback.is_valid())
957 void write_chunk(
char chunk,
unsigned char nbits)
960 if (bits_available_in_char == CHAR_BIT)
962 pdata[char_index] = 0U;
965 pdata[char_index] |= chunk;
973 void flush_full_bytes()
978 callback(callback_parameter_type(pdata, pdata + char_index));
980 bits_available = CHAR_BIT * length_chars;
982 if (bits_available_in_char != 0U)
985 pdata[0] = pdata[char_index];
986 bits_available -= (CHAR_BIT - bits_available_in_char);
997 void step(
unsigned char nbits)
999 bits_available_in_char -= nbits;
1001 if (bits_available_in_char == 0)
1004 bits_available_in_char = CHAR_BIT;
1007 bits_available -= nbits;
1011 const size_t length_chars;
1012 const etl::bit_order bit_order;
1013 const etl::endian byte_order;
1014 unsigned char bits_available_in_char;
1017 size_t bits_available;
1019 callback_type callback;
1037 return stream.
write(value);
1045 template <
typename T>
1047 uint_least8_t nbits = CHAR_BIT *
sizeof(T))
1057 template <
typename T>
1059 uint_least8_t nbits = CHAR_BIT *
sizeof(T))
1061 return stream.
write(value, nbits);
1071 typedef char value_type;
1072 typedef const char* const_iterator;
1077 template <
size_t Length>
1079 : pdata(span_.
begin())
1081 , bit_order(bit_order_)
1082 , byte_order(byte_order_)
1090 template <
size_t Length>
1092 : pdata(reinterpret_cast<const char*>(span_.
begin()))
1094 , bit_order(bit_order_)
1095 , byte_order(byte_order_)
1103 template <
size_t Length>
1105 : pdata(span_.
begin())
1107 , bit_order(bit_order_)
1108 , byte_order(byte_order_)
1116 template <
size_t Length>
1118 : pdata(reinterpret_cast<const char*>(span_.
begin()))
1120 , bit_order(bit_order_)
1121 , byte_order(byte_order_)
1130 : pdata(reinterpret_cast<const char*>(begin_))
1131 , length_chars(static_cast<size_t>(
etl::distance(reinterpret_cast<const char*>(begin_), reinterpret_cast<const char*>(end_))))
1132 , bit_order(bit_order_)
1133 , byte_order(byte_order_)
1142 : pdata(reinterpret_cast<const char*>(begin_))
1143 , length_chars(length_)
1144 , bit_order(bit_order_)
1145 , byte_order(byte_order_)
1155 bits_available_in_char = CHAR_BIT;
1157 bits_available = CHAR_BIT * length_chars;
1163 template <
typename T>
1172 template <
typename T>
1177 if (bits_available > 0U)
1188 template <
typename T>
1189 typename etl::enable_if< etl::is_integral<T>::value && !etl::is_same<bool, T>::value, T>
::type read_unchecked(uint_least8_t nbits = CHAR_BIT
1192 typedef typename etl::unsigned_type<T>::type unsigned_t;
1194 T value =
static_cast<T
>(read_value<unsigned_t>(nbits, etl::is_signed<T>::value));
1196 return static_cast<T
>(value);
1202 template <
typename T>
1203 typename etl::enable_if<etl::is_integral<T>::value && !etl::is_same<bool, T>::value,
etl::optional<T> >
::type
1204 read(uint_least8_t nbits = CHAR_BIT *
sizeof(T))
1209 if (bits_available >= nbits)
1222 return length_chars;
1230 return length_chars * CHAR_BIT;
1280 bool success = (nbits <= bits_available);
1284 while (nbits > bits_available_in_char)
1286 nbits -= bits_available_in_char;
1287 step(bits_available_in_char);
1292 step(
static_cast<unsigned char>(nbits));
1305 template <
typename T>
1306 T read_value(uint_least8_t nbits,
bool is_signed)
1308 ETL_ASSERT(nbits <= (CHAR_BIT *
sizeof(T)), ETL_ERROR_GENERIC(
"bit_stream_reader::read_value: nbits too large"));
1311 uint_least8_t bits = nbits;
1316 unsigned char mask_width =
static_cast<unsigned char>(etl::min(nbits, bits_available_in_char));
1318 T chunk = get_chunk(mask_width);
1320 nbits -= mask_width;
1321 value |=
static_cast<T
>(chunk << nbits);
1326 value = value << ((CHAR_BIT *
sizeof(T)) - bits);
1332 if ((byte_order == etl::endian::little) && (bits == (CHAR_BIT *
sizeof(T))))
1337 if (is_signed && (bits != (CHAR_BIT *
sizeof(T))))
1348 unsigned char get_chunk(
unsigned char nbits)
1350 unsigned char value =
static_cast<unsigned char>(pdata[char_index]);
1351 value >>= (bits_available_in_char - nbits);
1355 if (nbits == CHAR_BIT)
1357 mask = etl::integral_limits<unsigned char>::max;
1361 mask =
static_cast<unsigned char>((1U << nbits) - 1);
1376 bool result = (
static_cast<unsigned char>(pdata[char_index]) & (1U << (bits_available_in_char - 1U))) != 0U;
1387 void step(
unsigned char nbits)
1389 bits_available_in_char -= nbits;
1391 if (bits_available_in_char == 0)
1394 bits_available_in_char = 8;
1397 bits_available -= nbits;
1401 size_t length_chars;
1402 const etl::bit_order bit_order;
1403 const etl::endian byte_order;
1404 unsigned char bits_available_in_char;
1407 size_t bits_available;
1414 template <
typename T>
1420 template <
typename T>
1429 template <
typename T>
1432 return stream.
read<T>();
1435 template <
typename T>
1438 return stream.
read<T>(nbits);
1456 return stream.
read<
bool>();
Reads bit streams.
Definition bit_stream.h:1068
etl::enable_if< etl::is_same< bool, T >::value, etl::optional< bool > >::type read()
For bool types.
Definition bit_stream.h:1173
const_iterator end() const
Returns end of the stream.
Definition bit_stream.h:1252
const_iterator cend() const
Returns end of the stream.
Definition bit_stream.h:1260
bit_stream_reader(const etl::span< char, Length > &span_, etl::bit_order bit_order_, etl::endian byte_order_=etl::endian::big)
Construct from span.
Definition bit_stream.h:1078
size_t size_bits() const
Returns the number of bits in the stream buffer.
Definition bit_stream.h:1228
etl::enable_if< etl::is_integral< T >::value &&!etl::is_same< bool, T >::value, T >::type read_unchecked(uint_least8_t nbits=CHAR_BIT *sizeof(T))
For integral types.
Definition bit_stream.h:1189
bool skip(size_t nbits)
Definition bit_stream.h:1278
bit_stream_reader(const etl::span< const unsigned char, Length > &span_, etl::bit_order bit_order_, etl::endian byte_order_=etl::endian::big)
Construct from span.
Definition bit_stream.h:1117
etl::enable_if< etl::is_integral< T >::value &&!etl::is_same< bool, T >::value, etl::optional< T > >::type read(uint_least8_t nbits=CHAR_BIT *sizeof(T))
For integral types.
Definition bit_stream.h:1204
void restart()
Sets the indexes back to the beginning of the stream.
Definition bit_stream.h:1153
bit_stream_reader(const etl::span< const char, Length > &span_, etl::bit_order bit_order_, etl::endian byte_order_=etl::endian::big)
Construct from span.
Definition bit_stream.h:1104
bit_stream_reader(const etl::span< unsigned char, Length > &span_, etl::bit_order bit_order_, etl::endian byte_order_=etl::endian::big)
Construct from span.
Definition bit_stream.h:1091
bit_stream_reader(const void *begin_, const void *end_, etl::bit_order bit_order_, etl::endian byte_order_=etl::endian::big)
Construct from range.
Definition bit_stream.h:1129
bit_stream_reader(const void *begin_, size_t length_, etl::bit_order bit_order_, etl::endian byte_order_=etl::endian::big)
Construct from begin and length.
Definition bit_stream.h:1141
const_iterator cbegin() const
Returns start of the stream.
Definition bit_stream.h:1244
etl::enable_if< etl::is_same< bool, T >::value, bool >::type read_unchecked()
For bool types.
Definition bit_stream.h:1164
etl::span< const char > data() const
Returns a span of whole the stream.
Definition bit_stream.h:1268
const_iterator begin() const
Returns start of the stream.
Definition bit_stream.h:1236
size_t size_bytes() const
Returns the number of bytes in the stream buffer.
Definition bit_stream.h:1220
Writes bits streams.
Definition bit_stream.h:548
etl::enable_if< etl::is_integral< T >::value, bool >::type write(T value, uint_least8_t nbits=CHAR_BIT *sizeof(T))
For integral types.
Definition bit_stream.h:696
size_t size_bytes() const
Returns the number of bytes used in the stream.
Definition bit_stream.h:737
etl::enable_if< etl::is_integral< T >::value, void >::type write_unchecked(T value, uint_least8_t nbits=CHAR_BIT *sizeof(T))
For integral types.
Definition bit_stream.h:685
etl::span< const char > used_data() const
Returns a span of the used portion of the stream.
Definition bit_stream.h:854
bool write(bool value)
Writes a boolean to the stream.
Definition bit_stream.h:669
size_t size_bits() const
Returns the number of bits used in the stream.
Definition bit_stream.h:753
size_t available_bits() const
The number of bits left in the stream.
Definition bit_stream.h:790
const_iterator cend() const
Returns end of the stream.
Definition bit_stream.h:838
bit_stream_writer(void *begin_, void *end_, etl::bit_order bit_order_, callback_type callback_=callback_type(), etl::endian byte_order_=etl::endian::big)
Construct from range.
Definition bit_stream.h:590
callback_type get_callback() const
Gets the function to call after every write.
Definition bit_stream.h:903
bool empty() const
Returns true if the bitsteam indexes have been reset.
Definition bit_stream.h:644
bit_stream_writer(void *begin_, size_t length_chars_, etl::bit_order bit_order_, callback_type callback_=callback_type(), etl::endian byte_order_=etl::endian::big)
Construct from begin and length.
Definition bit_stream.h:604
iterator end()
Returns end of the stream.
Definition bit_stream.h:822
void set_callback(callback_type callback_)
Sets the function to call after every write.
Definition bit_stream.h:895
size_t available() const
Definition bit_stream.h:763
etl::span< char > data()
Returns a span of whole the stream.
Definition bit_stream.h:862
bool full() const
Returns true if the bitsteam indexes have reached the end.
Definition bit_stream.h:652
bool skip(size_t nbits)
Definition bit_stream.h:713
size_t capacity_bits() const
Returns the maximum capacity in bits.
Definition bit_stream.h:636
etl::span< char > used_data()
Returns a span of the used portion of the stream.
Definition bit_stream.h:846
bit_stream_writer(const etl::span< char, Length > &span_, etl::bit_order bit_order_, callback_type callback_=callback_type(), etl::endian byte_order_=etl::endian::big)
Construct from span.
Definition bit_stream.h:561
size_t capacity_bytes() const
Returns the maximum capacity in bytes.
Definition bit_stream.h:628
etl::span< const char > data() const
Returns a span of whole the stream.
Definition bit_stream.h:870
void restart()
Sets the indexes back to the beginning of the stream.
Definition bit_stream.h:618
void write_unchecked(bool value)
Writes a boolean to the stream.
Definition bit_stream.h:660
void flush()
Flush the last byte, if partially filled, to the callback, if valid.
Definition bit_stream.h:878
const_iterator cbegin() const
Returns start of the stream.
Definition bit_stream.h:814
size_t available(size_t nbits) const
Definition bit_stream.h:782
const_iterator end() const
Returns end of the stream.
Definition bit_stream.h:830
const_iterator begin() const
Returns start of the stream.
Definition bit_stream.h:806
iterator begin()
Returns start of the stream.
Definition bit_stream.h:798
bit_stream_writer(const etl::span< unsigned char, Length > &span_, etl::bit_order bit_order_, callback_type callback_=callback_type(), etl::endian byte_order_=etl::endian::big)
Construct from span.
Definition bit_stream.h:576
etl::enable_if< etl::is_integral< T >::value, bool >::type get(T &value, uint_least8_t nbits=CHAR_BIT *sizeof(T))
For integral types.
Definition bit_stream.h:241
etl::enable_if< etl::is_integral< T >::value, bool >::type put(T value, uint_least8_t nbits=CHAR_BIT *sizeof(T))
For integral types.
Definition bit_stream.h:172
bool put(int64_t value, uint_least8_t nbits=CHAR_BIT *sizeof(int64_t))
For 64bit integral types.
Definition bit_stream.h:181
etl::enable_if< etl::is_floating_point< T >::value, bool >::type put(T value)
For floating point types.
Definition bit_stream.h:199
void restart()
Sets the indexes back to the beginning of the stream.
Definition bit_stream.h:133
size_t size() const
Returns the number of bytes used in the stream.
Definition bit_stream.h:314
size_t bits() const
Returns the number of bits used in the stream.
Definition bit_stream.h:330
bit_stream(void *begin_, void *end_)
Construct from range.
Definition bit_stream.h:95
bool put(uint64_t value, uint_least8_t nbits=CHAR_BIT *sizeof(uint64_t))
For 64bit integral types.
Definition bit_stream.h:189
bit_stream(void *begin_, size_t length_)
Construct from begin and length.
Definition bit_stream.h:105
etl::enable_if< etl::is_floating_point< T >::value, bool >::type get(T &value)
For floating point types.
Definition bit_stream.h:283
bool at_end() const
Returns true if the bitsteam indexes have reached the end.
Definition bit_stream.h:143
bool put(bool value)
Writes a boolean to the stream.
Definition bit_stream.h:151
bit_stream()
Default constructor.
Definition bit_stream.h:85
bool get(bool &value)
For bool types.
Definition bit_stream.h:220
void set_stream(void *begin_, size_t length_)
Construct from begin and length.
Definition bit_stream.h:115
void set_stream(void *begin_, void *end_)
Construct from range.
Definition bit_stream.h:125
const_iterator end() const
Returns end of the stream.
Definition bit_stream.h:346
const_iterator begin() const
Returns start of the stream.
Definition bit_stream.h:338
Declaration.
Definition delegate_cpp03.h:191
Span - Fixed Extent.
Definition span.h:208
ETL_CONSTEXPR14 etl::enable_if< etl::is_integral< T >::value &&etl::is_unsigned< T >::value &&(etl::integral_limits< T >::bits==16U), T >::type reverse_bits(T value)
Definition binary.h:542
ETL_CONSTEXPR14 etl::enable_if< etl::is_integral< T >::value &&etl::is_unsigned< T >::value &&(etl::integral_limits< T >::bits==16U), T >::type reverse_bytes(T value)
Definition binary.h:745
ETL_CONSTEXPR14 TReturn sign_extend(TValue value)
Definition binary.h:273
Definition endianness.h:100
#define ETL_ASSERT(b, e)
Definition error_handler.h:511
Definition optional.h:1238
#define ETL_DECLARE_ENUM_TYPE(TypeName, ValueType)
Definition enum_type.h:90
ETL_CONSTEXPR TContainer::pointer data(TContainer &container)
Definition iterator.h:1470
bool read_unchecked< bool >(etl::bit_stream_reader &stream)
Read an unchecked bool from a stream.
Definition bit_stream.h:1445
etl::optional< T > read(etl::bit_stream_reader &stream)
Read a checked type from a stream.
Definition bit_stream.h:1430
void write_unchecked(etl::bit_stream_writer &stream, bool value)
Definition bit_stream.h:1026
ETL_CONSTEXPR TContainer::size_type size(const TContainer &container)
Definition iterator.h:1434
T & get(array< T, Size > &a)
Definition array.h:1158
etl::optional< bool > read< bool >(etl::bit_stream_reader &stream)
Read a bool from a stream.
Definition bit_stream.h:1454
T read_unchecked(etl::bit_stream_reader &stream)
Read an unchecked type from a stream.
Definition bit_stream.h:1415
bool write(etl::bit_stream_writer &stream, bool value)
Definition bit_stream.h:1035
Definition bit_stream.h:59
enum_type
Definition bit_stream.h:61
@ lsb_first
Least significant bit first.
Definition bit_stream.h:62
@ msb_first
Most significant bit first.
Definition bit_stream.h:63
is_signed
Definition type_traits.h:458