[x265] [PATCH] threading: use InterlockedExchangeAdd for ATOMIC_ADD
gopu at multicorewareinc.com
gopu at multicorewareinc.com
Mon Feb 2 10:05:14 CET 2015
# HG changeset patch
# User Gopu Govindaswamy <gopu at 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)
#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)
More information about the x265-devel
mailing list