I would like to promote more of my endianness logic to compile time constexpr's. I know that in C++20, this is highly standardized via std::endian
. However, for the moment I am targeting C++17.
How can I query the target architecture's endianness from within my C++ code? Prefer simple constexpr
functions and macros to autoconf. Would appreciate working snippets for GCC, Clang, and MSVC.