* Fix histogram test Use different Start index so skipped start_index copy would not get unnoticed in the test. * Fix several test_vector_* for valid data Instead of comparing the moved-from data which is invalid, compare with the valid initial_data. * Fix test_vector to check for the correct iterator position after erase This was done before, but a recent change dropped it. * Fix bit_stream: Guard nbits > 0 to prevent division by zero * Cleanup --------- Co-authored-by: John Wellbelove <jwellbelove@users.noreply.github.com>
2.1 KiB
| title |
|---|
| endian |
{{< callout type="info">}}
Header: endianness.h
Since: TBC
{{< /callout >}}
Constants & utilities for endianness.
For endian specific integral types, see unaligned_type.
The values for endianness are dependent on the platform setup.
If ETL_ENDIAN_NATIVE is defined by the user, then
etl::endian::little = 0
etl::endian::big = 1
If ETL_ENDIAN_NATIVE is not defined by the user, then the ETL selects an appropriate definition.
If ETL_CPP20_SUPPORTED == 1 and ETL_USING_STL == 1 then
etl::endian::little = std::endian::little
etl::endian::big = std::endian::big
etl::endian::native = std::endian::native
else if __BYTE_ORDER__ is defined then
If __ORDER_LITTLE_ENDIAN__ is defined then
etl::endian::little = __ORDER_LITTLE_ENDIAN__
etl::endian::big = __ORDER_BIG_ENDIAN__
etl::endian::native = __BYTE_ORDER__
else if __LITTLE_ENDIAN__ is defined
etl::endian::little = __LITTLE_ENDIAN__
etl::endian::big = __BIG_ENDIAN__
etl::endian::native = __BYTE_ORDER__
else
The user needs to define ETL_ENDIAN_NATIVE either as 0 for little endian or 1 for big endian.
endian
A smart enumeration defining little and big members.
etl::endian::little;
etl::endian::big;
endianness
Interrogates the endianness of the platform.
etl::endian operator ()() const
constexpr if ETL_CPP11_SUPPORTED == 1 and ETL_ENDIAN_NATIVE is defined.
operator etl::endian() const
constexpr if ETL_CPP11_SUPPORTED == 1 and ETL_ENDIAN_NATIVE is defined.
static etl::endian value()
constexpr if ETL_CPP11_SUPPORTED == 1 and ETL_ENDIAN_NATIVE is defined.
Host to network
template <typename T>
T hton(T value)
Description
Converts value from host to network ordering.
Network to host
template <typename T>
T ntoh(T value)
Description
Converts value from network to host ordering.