vm::atomic -> atomic_t
This commit is contained in:
@@ -188,3 +188,37 @@ static __forceinline uint64_t InterlockedXor(volatile uint64_t* dest, uint64_t v
|
||||
return _InterlockedXor64((volatile long long*)dest, value);
|
||||
}
|
||||
#endif
|
||||
|
||||
static __forceinline uint32_t cntlz32(uint32_t arg)
|
||||
{
|
||||
#if defined(__GNUG__)
|
||||
return __builtin_clzl(arg);
|
||||
#else
|
||||
unsigned long res;
|
||||
if (!_BitScanReverse(&res, arg))
|
||||
{
|
||||
return 32;
|
||||
}
|
||||
else
|
||||
{
|
||||
return res ^ 31;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
static __forceinline uint64_t cntlz64(uint64_t arg)
|
||||
{
|
||||
#if defined(__GNUG__)
|
||||
return __builtin_clzll(arg);
|
||||
#else
|
||||
unsigned long res;
|
||||
if (!_BitScanReverse64(&res, arg))
|
||||
{
|
||||
return 64;
|
||||
}
|
||||
else
|
||||
{
|
||||
return res ^ 63;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
+3
-3
@@ -1,5 +1,5 @@
|
||||
#pragma once
|
||||
#include "Emu/Memory/vm_atomic.h"
|
||||
#include "Emu/Memory/atomic_type.h"
|
||||
|
||||
bool SM_IsAborted();
|
||||
void SM_Sleep();
|
||||
@@ -25,9 +25,9 @@ template
|
||||
>
|
||||
class SMutexBase
|
||||
{
|
||||
static_assert(sizeof(T) == sizeof(vm::atomic_le<T>), "Invalid SMutexBase type");
|
||||
static_assert(sizeof(T) == sizeof(atomic_le_t<T>), "Invalid SMutexBase type");
|
||||
T owner;
|
||||
typedef vm::atomic_le<T> AT;
|
||||
typedef atomic_le_t<T> AT;
|
||||
|
||||
public:
|
||||
static const T GetFreeValue()
|
||||
|
||||
Reference in New Issue
Block a user