From 559058823b54b7f5081cb09da42c792682c8d151 Mon Sep 17 00:00:00 2001 From: divverent Date: Mon, 11 Apr 2011 06:51:56 +0000 Subject: [PATCH] fix mingw breakage on Ubuntu git-svn-id: svn://svn.icculus.org/twilight/trunk/darkplaces@11050 d7cf8633-e32d-0410-b094-e92efae38249 --- dpsoftrast.c | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/dpsoftrast.c b/dpsoftrast.c index 75d6db80..86d4f7b5 100644 --- a/dpsoftrast.c +++ b/dpsoftrast.c @@ -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))) -- 2.39.2