mirror of
https://github.com/RPCS3/rpcs3.git
synced 2024-11-25 04:02:42 +01:00
MacOs build fix proposal.
Made on Big Sur, removing few unnecessary old specifics. Build with LLVM homebrew.
This commit is contained in:
parent
68fa377d13
commit
b6732fbae9
@ -2984,9 +2984,12 @@ std::pair<void*, usz> thread_ctrl::get_thread_stack()
|
||||
void* saddr = 0;
|
||||
usz ssize = 0;
|
||||
pthread_attr_t attr;
|
||||
#ifdef __linux__
|
||||
#if defined(__linux__)
|
||||
pthread_getattr_np(pthread_self(), &attr);
|
||||
pthread_attr_getstack(&attr, &saddr, &ssize);
|
||||
#elif defined(__APPLE__)
|
||||
saddr = pthread_get_stackaddr_np(pthread_self());
|
||||
ssize = pthread_get_stacksize_np(pthread_self());
|
||||
#else
|
||||
pthread_attr_get_np(pthread_self(), &attr);
|
||||
pthread_attr_getstackaddr(&attr, &saddr);
|
||||
|
@ -195,7 +195,7 @@ u16 np_handler::RoomDataInternal_to_SceNpMatching2RoomDataInternal(const RoomDat
|
||||
{
|
||||
if (room_info->roomGroup[g_index].groupId == member->roomGroup())
|
||||
{
|
||||
member_info->roomGroup = vm::cast(room_info->roomGroup.addr() + (sizeof(SceNpMatching2RoomGroup) * g_index));
|
||||
member_info->roomGroup = vm::cast(room_info->roomGroup.addr() + (u32{sizeof(SceNpMatching2RoomGroup)} * g_index));
|
||||
found = true;
|
||||
}
|
||||
}
|
||||
|
@ -26,7 +26,7 @@
|
||||
#include <unistd.h>
|
||||
#endif
|
||||
|
||||
#ifdef __FreeBSD__
|
||||
#if defined(__FreeBSD__) || defined(__APPLE__)
|
||||
#include <ifaddrs.h>
|
||||
#include <net/if_dl.h>
|
||||
#endif
|
||||
@ -139,7 +139,7 @@ bool np_handler::discover_ip_address()
|
||||
|
||||
bool np_handler::discover_ether_address()
|
||||
{
|
||||
#ifdef __FreeBSD__
|
||||
#if defined(__FreeBSD__) || defined(__APPLE__)
|
||||
ifaddrs* ifap;
|
||||
|
||||
if (getifaddrs(&ifap) == 0)
|
||||
|
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user