16#if __has_include(<endian.h>)
18#elif __has_include(<sys/endian.h>)
19# include <sys/endian.h>
24namespace seqan3::detail
38template <std::
integral type>
39constexpr type to_little_endian(type
const in)
noexcept
41 if constexpr (std::endian::native == std::endian::little)
45 else if constexpr (std::endian::native == std::endian::big)
47 static_assert(
sizeof(type) <= 8,
48 "Can only convert the byte encoding for integral numbers with a size of up to 8 bytes.");
50 "Can only convert the byte encoding for integral numbers whose byte size is a power of two.");
52 if constexpr (
sizeof(type) == 2)
54 else if constexpr (
sizeof(type) == 4)
56 else if constexpr (
sizeof(type) == 8)
63 static_assert(std::endian::native == std::endian::little || std::endian::native == std::endian::big,
64 "Expected a little-endian or big-endian platform.");
T has_single_bit(T... args)