[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [59181] branches/soc-2013-depsgraph_mt/ intern/atomic/atomic_ops.h: Attempt to fix compilation error on OSX and Windows

Sergey Sharybin sergey.vfx at gmail.com
Fri Aug 16 12:29:57 CEST 2013


Revision: 59181
          http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=59181
Author:   nazgul
Date:     2013-08-16 10:29:56 +0000 (Fri, 16 Aug 2013)
Log Message:
-----------
Attempt to fix compilation error on OSX and Windows

Modified Paths:
--------------
    branches/soc-2013-depsgraph_mt/intern/atomic/atomic_ops.h

Modified: branches/soc-2013-depsgraph_mt/intern/atomic/atomic_ops.h
===================================================================
--- branches/soc-2013-depsgraph_mt/intern/atomic/atomic_ops.h	2013-08-16 10:01:09 UTC (rev 59180)
+++ branches/soc-2013-depsgraph_mt/intern/atomic/atomic_ops.h	2013-08-16 10:29:56 UTC (rev 59181)
@@ -29,6 +29,12 @@
 #ifndef ATOMIC_OPS_H__
 #define ATOMIC_OPS_H__
 
+#if defined (__APPLE__)
+#  include <libkern/OSAtomic.h>
+#elif defined(_MSC_VER)
+#  include <windows.h>
+#endif
+
 /* needed for int types */
 #include "../../source/blender/blenlib/BLI_sys_types.h"
 
@@ -44,8 +50,7 @@
 #  endif
 #endif
 
-/* TODO(sergey): check on other 64bit platforms. */
-#if defined(_M_X64) || defined(_M_AMD64) || defined(__amd64__) || defined(__x86_64__)
+#if defined(_M_X64) || defined(__amd64__) || defined(__x86_64__)
 #  define LG_SIZEOF_PTR 3
 #  define LG_SIZEOF_INT 3
 #else
@@ -80,7 +85,7 @@
 {
 	return (InterlockedExchangeAdd64(p, -((int64_t)x)));
 }
-#elif (defined(JEMALLOC_OSATOMIC))
+#elif (defined(__APPLE__))
 ATOMIC_INLINE uint64_t
 atomic_add_uint64(uint64_t *p, uint64_t x)
 {
@@ -178,7 +183,7 @@
 {
 	return (InterlockedExchangeAdd(p, -((int32_t)x)));
 }
-#elif (defined(JEMALLOC_OSATOMIC))
+#elif (defined(__APPLE__))
 ATOMIC_INLINE uint32_t
 atomic_add_uint32(uint32_t *p, uint32_t x)
 {
@@ -258,10 +263,10 @@
 {
 #if (LG_SIZEOF_PTR == 3)
 	return ((size_t)atomic_add_uint64((uint64_t *)p,
-	    (uint64_t) - ((int64_t)x)));
+	    (uint64_t)-((int64_t)x)));
 #elif (LG_SIZEOF_PTR == 2)
 	return ((size_t)atomic_add_uint32((uint32_t *)p,
-	    (uint32_t) - ((int32_t)x)));
+	    (uint32_t)-((int32_t)x)));
 #endif
 }
 
@@ -282,10 +287,10 @@
 {
 #if (LG_SIZEOF_INT == 3)
 	return ((unsigned)atomic_add_uint64((uint64_t *)p,
-	    (uint64_t) - ((int64_t)x)));
+	    (uint64_t)-((int64_t)x)));
 #elif (LG_SIZEOF_INT == 2)
 	return ((unsigned)atomic_add_uint32((uint32_t *)p,
-	    (uint32_t) - ((int32_t)x)));
+	    (uint32_t)-((int32_t)x)));
 #endif
 }
 




More information about the Bf-blender-cvs mailing list