Skip to content

Commit

Permalink
Changes to compile under Xcode 14.2.
Browse files Browse the repository at this point in the history
#include <bit> with bit_cast<> was not instroduced until Xcode 14.3 which requires
macOS 13.x (Ventura)

Signed-off-by: Michael Jackson <[email protected]>
  • Loading branch information
imikejackson committed Aug 1, 2024
1 parent ec8d54c commit 7ba3801
Showing 1 changed file with 16 additions and 4 deletions.
20 changes: 16 additions & 4 deletions src/simplnx/Common/TypesUtility.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -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 <bit>
namespace bs = std;
#else
#include "Bit.hpp"
namespace bs = nx::core;
#endif
#else
#include <bit>
namespace bs = std;
#endif

#include <optional>
#include <stdexcept>
#include <vector>
Expand All @@ -21,19 +33,19 @@ constexpr T GetMudflap() noexcept
{
if constexpr(sizeof(T) == 1)
{
return std::bit_cast<T>(static_cast<uint8>(0xAB));
return bs::bit_cast<T>(static_cast<uint8>(0xAB));
}
if constexpr(sizeof(T) == 2)
{
return std::bit_cast<T>(static_cast<uint16>(0xABAB));
return bs::bit_cast<T>(static_cast<uint16>(0xABAB));
}
if constexpr(sizeof(T) == 4)
{
return std::bit_cast<T>(static_cast<uint32>(0xABABABAB));
return bs::bit_cast<T>(static_cast<uint32>(0xABABABAB));
}
if constexpr(sizeof(T) == 8)
{
return std::bit_cast<T>(static_cast<uint64>(0xABABABABABABABAB));
return bs::bit_cast<T>(static_cast<uint64>(0xABABABABABABABAB));
}
}

Expand Down

0 comments on commit 7ba3801

Please sign in to comment.