From: divverent Date: Mon, 11 Apr 2011 06:51:56 +0000 (+0000) Subject: fix mingw breakage on Ubuntu X-Git-Tag: xonotic-v0.6.0~163^2~496 X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=559058823b54b7f5081cb09da42c792682c8d151;p=xonotic%2Fdarkplaces.git fix mingw breakage on Ubuntu git-svn-id: svn://svn.icculus.org/twilight/trunk/darkplaces@11050 d7cf8633-e32d-0410-b094-e92efae38249 --- 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)))