| 266 | // Implementation of std::bit_cast for pre-C++20. |
| 267 | template <typename To, typename From, FMT_ENABLE_IF(sizeof(To) == sizeof(From))> |
| 268 | FMT_CONSTEXPR20 auto bit_cast(const From& from) -> To { |
| 269 | #ifdef __cpp_lib_bit_cast |
| 270 | if (is_constant_evaluated()) return std::bit_cast<To>(from); |
| 271 | #endif |
| 272 | auto to = To(); |
| 273 | // The cast suppresses a bogus -Wclass-memaccess on GCC. |
| 274 | memcpy(static_cast<void*>(&to), &from, sizeof(to)); |
| 275 | return to; |
| 276 | } |
| 277 | |
| 278 | inline auto is_big_endian() -> bool { |
| 279 | #ifdef _WIN32 |
nothing calls this directly
no test coverage detected