From 7ba38016fe32a78fabd5d79f583f966ee9d4e553 Mon Sep 17 00:00:00 2001 From: Michael Jackson Date: Thu, 1 Aug 2024 13:21:53 -0400 Subject: [PATCH] Changes to compile under Xcode 14.2. #include with bit_cast<> was not instroduced until Xcode 14.3 which requires macOS 13.x (Ventura) Signed-off-by: Michael Jackson --- src/simplnx/Common/TypesUtility.hpp | 20 ++++++++++++++++---- 1 file changed, 16 insertions(+), 4 deletions(-) diff --git a/src/simplnx/Common/TypesUtility.hpp b/src/simplnx/Common/TypesUtility.hpp index 4d07bf22a4..93d196048a 100644 --- a/src/simplnx/Common/TypesUtility.hpp +++ b/src/simplnx/Common/TypesUtility.hpp @@ -4,7 +4,19 @@ #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 @@ -21,19 +33,19 @@ constexpr T GetMudflap() noexcept { if constexpr(sizeof(T) == 1) { - return std::bit_cast(static_cast(0xAB)); + return bs::bit_cast(static_cast(0xAB)); } if constexpr(sizeof(T) == 2) { - return std::bit_cast(static_cast(0xABAB)); + return bs::bit_cast(static_cast(0xABAB)); } if constexpr(sizeof(T) == 4) { - return std::bit_cast(static_cast(0xABABABAB)); + return bs::bit_cast(static_cast(0xABABABAB)); } if constexpr(sizeof(T) == 8) { - return std::bit_cast(static_cast(0xABABABABABABABAB)); + return bs::bit_cast(static_cast(0xABABABABABABABAB)); } }