Unicorn interface working with test app in 32bit and 64bit builds.
This commit is contained in:
@ -199,18 +199,13 @@
|
||||
|
||||
/* Provide shorter names for GCC atomic builtins. */
|
||||
#ifdef _MSC_VER
|
||||
#ifdef _WIN64
|
||||
#define atomic_fetch_inc(ptr) InterlockedIncrement64(ptr)
|
||||
#define atomic_fetch_dec(ptr) InterlockedDecrement64(ptr)
|
||||
#define atomic_fetch_add(ptr, n) InterlockedAdd64(ptr, n)
|
||||
#define atomic_fetch_sub(ptr, n) InterlockedAdd64(ptr, -n)
|
||||
#else
|
||||
#define atomic_fetch_inc(ptr) InterlockedIncrement(ptr)
|
||||
#define atomic_fetch_dec(ptr) InterlockedDecrement(ptr)
|
||||
#define atomic_fetch_add(ptr, n) InterlockedAdd(ptr, n)
|
||||
#define atomic_fetch_sub(ptr, n) InterlockedAdd(ptr, -n)
|
||||
#endif
|
||||
// these return the new value (so we make it return the previous value)
|
||||
#define atomic_fetch_inc(ptr) ((InterlockedIncrement(ptr))-1)
|
||||
#define atomic_fetch_dec(ptr) ((InterlockedDecrement(ptr))+1)
|
||||
#define atomic_fetch_add(ptr, n) ((InterlockedAdd(ptr, n))-n)
|
||||
#define atomic_fetch_sub(ptr, n) ((InterlockedAdd(ptr, -n))+n)
|
||||
#else
|
||||
// these return the previous value
|
||||
#define atomic_fetch_inc(ptr) __sync_fetch_and_add(ptr, 1)
|
||||
#define atomic_fetch_dec(ptr) __sync_fetch_and_add(ptr, -1)
|
||||
#define atomic_fetch_add __sync_fetch_and_add
|
||||
@ -222,17 +217,10 @@
|
||||
|
||||
/* And even shorter names that return void. */
|
||||
#ifdef _MSC_VER
|
||||
#ifdef _WIN64
|
||||
#define atomic_inc(ptr) ((void) InterlockedIncrement64(ptr))
|
||||
#define atomic_dec(ptr) ((void) InterlockedDecrement64(ptr))
|
||||
#define atomic_add(ptr, n) ((void) InterlockedAdd64(ptr, n))
|
||||
#define atomic_sub(ptr, n) ((void) InterlockedAdd64(ptr, -n))
|
||||
#else
|
||||
#define atomic_inc(ptr) ((void) InterlockedIncrement(ptr))
|
||||
#define atomic_dec(ptr) ((void) InterlockedDecrement(ptr))
|
||||
#define atomic_add(ptr, n) ((void) InterlockedAdd(ptr, n))
|
||||
#define atomic_sub(ptr, n) ((void) InterlockedAdd(ptr, -n))
|
||||
#endif
|
||||
#else
|
||||
#define atomic_inc(ptr) ((void) __sync_fetch_and_add(ptr, 1))
|
||||
#define atomic_dec(ptr) ((void) __sync_fetch_and_add(ptr, -1))
|
||||
|
@ -558,6 +558,9 @@ static inline int64_t cpu_get_real_ticks(void)
|
||||
|
||||
static inline int64_t cpu_get_real_ticks(void)
|
||||
{
|
||||
#ifdef _MSC_VER
|
||||
return __rdtsc();
|
||||
#else
|
||||
uint32_t low,high;
|
||||
int64_t val;
|
||||
asm volatile("rdtsc" : "=a" (low), "=d" (high));
|
||||
@ -565,6 +568,7 @@ static inline int64_t cpu_get_real_ticks(void)
|
||||
val <<= 32;
|
||||
val |= low;
|
||||
return val;
|
||||
#endif
|
||||
}
|
||||
|
||||
#elif defined(__hppa__)
|
||||
|
Reference in New Issue
Block a user