]> git.rm.cloudns.org Git - xonotic/darkplaces.git/commitdiff
fix mingw breakage on Ubuntu
authordivverent <divverent@d7cf8633-e32d-0410-b094-e92efae38249>
Mon, 11 Apr 2011 06:51:56 +0000 (06:51 +0000)
committerdivverent <divverent@d7cf8633-e32d-0410-b094-e92efae38249>
Mon, 11 Apr 2011 06:51:56 +0000 (06:51 +0000)
git-svn-id: svn://svn.icculus.org/twilight/trunk/darkplaces@11050 d7cf8633-e32d-0410-b094-e92efae38249

dpsoftrast.c

index 75d6db8016696f8b6ea38ef1e69ec2411089dd32..86d4f7b5cbc7d8a5da85e155a23124358cff7e9e 100644 (file)
@@ -33,9 +33,14 @@ typedef qboolean bool;
                #define MEMORY_BARRIER (_mm_sfence())
                //(__sync_synchronize())
                #define ATOMIC_COUNTER volatile LONG
-               #define ATOMIC_INCREMENT(counter) (InterlockedIncrement(&(counter)))
-               #define ATOMIC_DECREMENT(counter) (InterlockedDecrement(&(counter)))
-               #define ATOMIC_ADD(counter, val) ((void)InterlockedExchangeAdd(&(counter), (val)))
+               // this LONG * cast serves to fix an issue with broken mingw
+               // packages on Ubuntu; these only declare the function to take
+               // a LONG *, causing a compile error here. This seems to be
+               // error- and warn-free on platforms that DO declare
+               // InterlockedIncrement correctly, like mingw on Windows.
+               #define ATOMIC_INCREMENT(counter) (InterlockedIncrement((LONG *) &(counter)))
+               #define ATOMIC_DECREMENT(counter) (InterlockedDecrement((LONG *) &(counter)))
+               #define ATOMIC_ADD(counter, val) ((void)InterlockedExchangeAdd((LONG *) &(counter), (val)))
        #elif defined(__GNUC__)
                #define ALIGN(var) var __attribute__((__aligned__(16)))
                #define ATOMIC(var) var __attribute__((__aligned__(32)))