[PATCH v2 03/12] vkd3d: Add MSVC path for atomic_add_fetch

Hans-Kristian Arntzen post at arntzen-software.no
Tue Oct 1 05:33:40 CDT 2019


Signed-off-by: Hans-Kristian Arntzen <post at arntzen-software.no>
---
 include/private/vkd3d_common.h | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/include/private/vkd3d_common.h b/include/private/vkd3d_common.h
index d8fb361..c8dd047 100644
--- a/include/private/vkd3d_common.h
+++ b/include/private/vkd3d_common.h
@@ -164,8 +164,9 @@ static inline LONG InterlockedDecrement(LONG volatile *x)
 
 #if HAVE_SYNC_ADD_AND_FETCH
 # define atomic_add_fetch(ptr, val) __sync_add_and_fetch(ptr, val)
-#else
-# error "atomic_add_fetch() not implemented for this platform"
+#elif defined(_MSC_VER)
+/* InterlockedAdd returns value after increment, like add_and_fetch. */
+# define atomic_add_fetch(ptr, val) InterlockedAdd(ptr, val)
 #endif  /* HAVE_SYNC_ADD_AND_FETCH */
 
 static inline void vkd3d_parse_version(const char *version, int *major, int *minor)
-- 
2.23.0




More information about the wine-devel mailing list