19 #if __has_include(<endian.h>)
21 #elif __has_include(<sys/endian.h>)
22 #include <sys/endian.h>
27 namespace seqan3::detail
41 template <std::
integral type>
42 constexpr type to_little_endian(type
const in) noexcept
50 static_assert(
sizeof(type) <= 8,
51 "Can only convert the byte encoding for integral numbers with a size of up to 8 bytes.");
53 "Can only convert the byte encoding for integral numbers whose byte size is a power of two.");
55 if constexpr (
sizeof(type) == 2)
57 else if constexpr (sizeof(type) == 4)
59 else if constexpr (sizeof(type) == 8)
67 "Expected a little-endian or big-endian platform.");
Provides the C++20 <bit> header if it is not already available.
constexpr bool has_single_bit(T x) noexcept
Checks if x is an integral power of two.
Definition: bit:122
@ native
implementation-defined
@ little
implementation-defined
@ big
implementation-defined