From fb0dc0e6837f35dd5edcae9d8e8f9c7ed808be79 Mon Sep 17 00:00:00 2001 From: Jared Duffey Date: Tue, 27 Aug 2024 15:49:08 -0400 Subject: [PATCH] COMP: Switched to __cpp_lib_bit_cast to detect std::bit_cast availability (#1057) * Also moved namespace alias to inside the relevant function to reduce namespace pollution Signed-off-by: Jared Duffey --- src/simplnx/Common/TypesUtility.hpp | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/src/simplnx/Common/TypesUtility.hpp b/src/simplnx/Common/TypesUtility.hpp index 93d196048a..d72d2b13b3 100644 --- a/src/simplnx/Common/TypesUtility.hpp +++ b/src/simplnx/Common/TypesUtility.hpp @@ -4,23 +4,17 @@ #include "simplnx/Common/TypeTraits.hpp" #include "simplnx/Common/Types.hpp" -#if defined(__clang__) && defined(__clang_major__) && defined(__APPLE__) -#if __clang_major__ > 14 -#include -namespace bs = std; -#else -#include "Bit.hpp" -namespace bs = nx::core; -#endif -#else -#include -namespace bs = std; -#endif - #include #include #include +#include +#if __cpp_lib_bit_cast +#include +#else +#include "simplnx/Common/Bit.hpp" +#endif + namespace nx::core { /** @@ -31,6 +25,12 @@ namespace nx::core template constexpr T GetMudflap() noexcept { +#if __cpp_lib_bit_cast + namespace bs = std; +#else + namespace bs = nx::core; +#endif + if constexpr(sizeof(T) == 1) { return bs::bit_cast(static_cast(0xAB));