I suggest asserting that it’s either big or little endian:
#include <bit> #include <compare> struct pawned_pw { std::strong_ordering operator<=>(const pawned_pw& rhs) const { static_assert(std::endian::native == std::endian::big || std::endian::native == std::endian::little, "mixed-endianess architectures are not supported"); if constexpr (std::endian::native == std::endian::little) { return ...; } else { // big return ...; } } };