On 02/02, g...@multicorewareinc.com wrote:
> # HG changeset patch
> # User Gopu Govindaswamy <g...@multicorewareinc.com>
> # Date 1422867856 -19800
> #      Mon Feb 02 14:34:16 2015 +0530
> # Node ID 92bce6fdd447ef03a2e9245969739d58ecc3a2e9
> # Parent  db56dc779466c5b54a55b5dadbcd04e882011729
> threading: use InterlockedExchangeAdd for ATOMIC_ADD
> 
> This patch is to fix the build error in 32 bit compiler, the 32 bit compiler
> will not support for InterlockedAdd insted use InterlockedExchangeAdd, this is
> also adds a value to the target variable,
> 
> diff -r db56dc779466 -r 92bce6fdd447 source/common/threading.h
> --- a/source/common/threading.h       Mon Feb 02 10:23:10 2015 +0530
> +++ b/source/common/threading.h       Mon Feb 02 14:34:16 2015 +0530
> @@ -64,7 +64,7 @@
>  #define CTZ(id, x)                          _BitScanForward(&id, x)
>  #define ATOMIC_INC(ptr)                     InterlockedIncrement((volatile 
> LONG*)ptr)
>  #define ATOMIC_DEC(ptr)                     InterlockedDecrement((volatile 
> LONG*)ptr)
> -#define ATOMIC_ADD(ptr, value)              InterlockedAdd((volatile 
> LONG*)ptr, value)
> +#define ATOMIC_ADD(ptr, value)              InterlockedExchangeAdd((volatile 
> LONG*)ptr, value)

InterlockedExchangeAdd() returns the value before the add, but the GCC
version of ATOMIC_ADD() is returning the value after the add. Right now
there is no code which looks at the return value, but before there is we
need to make the two macros behave the same.

>  #define ATOMIC_OR(ptr, mask)                _InterlockedOr((volatile 
> LONG*)ptr, (LONG)mask)
>  #define ATOMIC_AND(ptr, mask)               _InterlockedAnd((volatile 
> LONG*)ptr, (LONG)mask)
>  #define GIVE_UP_TIME()                      Sleep(0)
> _______________________________________________
> x265-devel mailing list
> x265-devel@videolan.org
> https://mailman.videolan.org/listinfo/x265-devel

-- 
Steve Borho
_______________________________________________
x265-devel mailing list
x265-devel@videolan.org
https://mailman.videolan.org/listinfo/x265-devel

Reply via email to