Commit cdb1bda3 authored by Sam Lantinga's avatar Sam Lantinga

Use compiler intrinsics on Windows

parent 6654cd07
......@@ -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_bool
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);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment