Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
L
libSDL
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
PocketInsanity
libSDL
Commits
2216518b
Commit
2216518b
authored
Jan 17, 2011
by
Sam Lantinga
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Use compiler intrinsics, where available
parent
68afae13
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
11 additions
and
10 deletions
+11
-10
SDL_atomic.h
include/SDL_atomic.h
+11
-10
No files found.
include/SDL_atomic.h
View file @
2216518b
...
@@ -113,18 +113,19 @@ extern DECLSPEC void SDLCALL SDL_AtomicUnlock(SDL_SpinLock *lock);
...
@@ -113,18 +113,19 @@ extern DECLSPEC void SDLCALL SDL_AtomicUnlock(SDL_SpinLock *lock);
#ifndef SDL_DISABLE_ATOMIC_INLINE
#ifndef SDL_DISABLE_ATOMIC_INLINE
#if defined(__WIN32__)
#if defined(__WIN32__)
/* Don't include windows.h, since it may hose code that isn't expecting it,
#include <intrin.h>
but if someone has already included it, this is fair game... */
#define WIN32_LEAN_AND_MEAN
#include <windows.h>
#define SDL_AtomicSet(a, v)
InterlockedExchange(&(a)->value, v
)
#define SDL_AtomicSet(a, v)
_InterlockedExchange(&(a)->value, (v)
)
#define SDL_AtomicGet(a) ((a)->value)
#define SDL_AtomicGet(a) ((a)->value)
#define SDL_AtomicAdd(a, v) InterlockedAdd(&(a)->value, v)
#define SDL_AtomicAdd(a, v) _InterlockedExchangeAdd(&(a)->value, (v))
#define SDL_AtomicCAS(a, oldval, newval) (InterlockedCompareExchange(&(a)->value, newval, oldval) == (oldval))
#define SDL_AtomicCAS(a, oldval, newval) (_InterlockedCompareExchange(&(a)->value, (newval), (oldval)) == (oldval))
#define SDL_AtomicSetPtr(a, v) InterlockedExchangePointer(a, v)
#define SDL_AtomicSetPtr(a, v) (void)_InterlockedExchangePointer((a), (v))
#define SDL_AtomicGetPtr(a) (*(a))
#define SDL_AtomicGetPtr(a) (*(a))
#define SDL_AtomicCASPtr(a, oldval, newval) (InterlockedCompareExchangePointer(a, newval, oldval) == (oldval))
#if _M_IX86
#define SDL_AtomicCASPtr(a, oldval, newval) (_InterlockedCompareExchange((long*)(a), (long)(newval), (long)(oldval)) == (long)(oldval))
#else
#define SDL_AtomicCASPtr(a, oldval, newval) (_InterlockedCompareExchangePointer((a), (newval), (oldval)) == (oldval))
#endif
#elif defined(__MACOSX__)
#elif defined(__MACOSX__)
#include <libkern/OSAtomic.h>
#include <libkern/OSAtomic.h>
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment