Mercurial > sdl-ios-xcode
changeset 5015:1bf9e38431ec
Use compiler intrinsics on Windows
author | Sam Lantinga <slouken@libsdl.org> |
---|---|
date | Mon, 17 Jan 2011 14:05:43 -0800 |
parents | 22751715e11a |
children | cc879bc6c4cf |
files | src/atomic/SDL_spinlock.c |
diffstat | 1 files changed, 3 insertions(+), 3 deletions(-) [+] |
line wrap: on
line diff
--- a/src/atomic/SDL_spinlock.c Mon Jan 17 14:05:14 2011 -0800 +++ b/src/atomic/SDL_spinlock.c Mon Jan 17 14:05:43 2011 -0800 @@ -25,8 +25,7 @@ #include "SDL_timer.h" #if defined(__WIN32__) -#define WIN32_LEAN_AND_MEAN -#include <windows.h> +#include <intrin.h> #elif defined(__MACOSX__) #include <libkern/OSAtomic.h> @@ -39,7 +38,8 @@ SDL_AtomicTryLock(SDL_SpinLock *lock) { #if defined(__WIN32__) - return (InterlockedExchange(lock, 1) == 0); + SDL_COMPILE_TIME_ASSERT(locksize, sizeof(*lock) == sizeof(long)); + return (_InterlockedExchange((long*)lock, 1) == 0); #elif defined(__MACOSX__) return OSAtomicCompareAndSwap32Barrier(0, 1, lock);