MacOs build fix proposal.

Made on Big Sur, removing few unnecessary old specifics.
Build with LLVM homebrew.
This commit is contained in:
David Carlier 2021-04-18 11:26:49 +01:00 committed by Ivan
parent 68fa377d13
commit b6732fbae9
4 changed files with 7 additions and 55 deletions

View file

@ -80,11 +80,7 @@ using ulong = unsigned long;
using ullong = unsigned long long;
using llong = long long;
#if __APPLE__
using uptr = std::uint64_t;
#else
using uptr = std::uintptr_t;
#endif
using u8 = std::uint8_t;
using u16 = std::uint16_t;
@ -97,53 +93,6 @@ using s16 = std::int16_t;
using s32 = std::int32_t;
using s64 = std::int64_t;
#if __APPLE__
namespace std
{
template <typename T, typename = std::enable_if_t<std::is_unsigned_v<T>>>
constexpr int countr_zero(T x) noexcept
{
if (x == 0)
return sizeof(T) * 8;
if constexpr (sizeof(T) <= sizeof(uint))
return __builtin_ctz(x);
else if constexpr (sizeof(T) <= sizeof(ulong))
return __builtin_ctzl(x);
else if constexpr (sizeof(T) <= sizeof(ullong))
return __builtin_ctzll(x);
else
static_assert(sizeof(T) <= sizeof(ullong));
}
template <typename T, typename = std::enable_if_t<std::is_unsigned_v<T>>>
constexpr int countr_one(T x) noexcept
{
return countr_zero<T>(~x);
}
template <typename T, typename = std::enable_if_t<std::is_unsigned_v<T>>>
constexpr int countl_zero(T x) noexcept
{
if (x == 0)
return sizeof(T) * 8;
if constexpr (sizeof(T) <= sizeof(uint))
return __builtin_clz(x) - (sizeof(uint) - sizeof(T)) * 8;
else if constexpr (sizeof(T) <= sizeof(ulong))
return __builtin_clzl(x) - (sizeof(ulong) - sizeof(T)) * 8;
else if constexpr (sizeof(T) <= sizeof(ullong))
return __builtin_clzll(x) - (sizeof(ullong) - sizeof(T)) * 8;
else
static_assert(sizeof(T) <= sizeof(ullong));
}
template <typename T, typename = std::enable_if_t<std::is_unsigned_v<T>>>
constexpr int countl_one(T x) noexcept
{
return countl_zero<T>(~x);
}
}
#endif
// Get integral type from type size
template <usz N>
struct get_int_impl