vm::atomic update, be_t update

1) MakeFromLE replaced with make(), MakeFromBE removed. Compiler seems
to be able to optimize it anyway.
2) be_t<> conversion operator temporarily replaced with conversion
through LE because it can't work with all possible numeric conversions
(float<>int for example)
This commit is contained in:
Nekotekina
2014-09-20 03:16:11 +04:00
parent 0baf295c1b
commit 66000240ac
16 changed files with 98 additions and 89 deletions
+14 -3
View File
@@ -45,7 +45,7 @@ void strcpy_trunc(char(&dst)[size], const char(&src)[rsize])
#define INFINITE 0xFFFFFFFF
#define _CRT_ALIGN(x) __attribute__((aligned(x)))
#define InterlockedCompareExchange(ptr,new_val,old_val) __sync_val_compare_and_swap(ptr,old_val,new_val)
#define InterlockedCompareExchange64(ptr,new_val,old_val) __sync_val_compare_and_swap(ptr,old_val,new_val)
#define InterlockedExchange(ptr, value) __sync_lock_test_and_set(ptr, value)
inline int64_t InterlockedOr64(volatile int64_t *dest, int64_t val)
{
@@ -54,7 +54,7 @@ inline int64_t InterlockedOr64(volatile int64_t *dest, int64_t val)
do
{
olderval = oldval;
oldval = InterlockedCompareExchange64(dest, olderval | val, olderval);
oldval = __sync_val_compare_and_swap(dest, olderval | val, olderval);
} while (olderval != oldval);
return oldval;
}
@@ -100,4 +100,15 @@ static __forceinline uint64_t InterlockedCompareExchange(volatile uint64_t* dest
{
return _InterlockedCompareExchange64((volatile long long*)dest, exch, comp);
}
#endif
#endif
#ifndef InterlockedExchange
static __forceinline uint32_t InterlockedExchange(volatile uint32_t* dest, uint32_t value)
{
return _InterlockedExchange((volatile long*)dest, value);
}
static __forceinline uint64_t InterlockedExchange(volatile uint64_t* dest, uint64_t value)
{
return _InterlockedExchange64((volatile long long*)dest, value);
}
#endif