Fix compilation error on Armel architecture
authorSergey Sharybin <sergey.vfx@gmail.com>
Mon, 2 May 2016 07:55:08 +0000 (09:55 +0200)
committerSergey Sharybin <sergey.vfx@gmail.com>
Mon, 2 May 2016 07:55:08 +0000 (09:55 +0200)
__GCC_HAVE_SYNC_COMPARE_AND_SWAP_n are not defined on this architecture
for some reason, however those functions are available.

Adding a workaround for newly used __sync_fetch_and_and() function.

intern/atomic/atomic_ops.h

index dc06a51f85979ef61b764f2d5fbfa8e8464a8595..06eb8f21da6cdb62f714240ad065f0d3df52e9ad 100644 (file)
@@ -45,6 +45,7 @@
  * arm7 architecture does have both 32 and 64bit atomics, however
  * it's gcc doesn't have __GCC_HAVE_SYNC_COMPARE_AND_SWAP_n defined.
  */
+#  define JE_FORCE_SYNC_COMPARE_AND_SWAP_1
 #  define JE_FORCE_SYNC_COMPARE_AND_SWAP_8
 #  define JE_FORCE_SYNC_COMPARE_AND_SWAP_4
 #endif
@@ -399,6 +400,12 @@ atomic_fetch_and_and_uint8(uint8_t *p, uint8_t b)
        return _InterlockedAnd8((char *)p, (char)b);
 #endif
 }
+#elif defined(JE_FORCE_SYNC_COMPARE_AND_SWAP_1)
+ATOMIC_INLINE uint8_t
+atomic_fetch_and_and_uint8(uint8_t *p, uint8_t b)
+{
+       return __sync_fetch_and_and(p, b);
+}
 #else
 #  error "Missing implementation for 8-bit atomic operations"
 #endif