summaryrefslogtreecommitdiff
path: root/libavutil/atomic_gcc.h
diff options
context:
space:
mode:
authorAnton Khirnov <anton@khirnov.net>2013-03-08 20:57:31 +0100
committerAnton Khirnov <anton@khirnov.net>2013-03-09 08:36:40 +0100
commit6327c10702922eabcb1c6170abd3f03d23ce4c51 (patch)
tree1cb1693eed4fccb309a3479de600ca47549de41a /libavutil/atomic_gcc.h
parent486f0b0cfc800cd38ec06635630539431d296774 (diff)
atomic: fix CAS with armcc.
On the current code, armcc will fail with: "libavutil/atomic_gcc.h", line 52: Error: #2771: first argument must be a pointer to integer or enumeration type
Diffstat (limited to 'libavutil/atomic_gcc.h')
-rw-r--r--libavutil/atomic_gcc.h8
1 files changed, 8 insertions, 0 deletions
diff --git a/libavutil/atomic_gcc.h b/libavutil/atomic_gcc.h
index 13713c82e0..9470e8e50b 100644
--- a/libavutil/atomic_gcc.h
+++ b/libavutil/atomic_gcc.h
@@ -21,6 +21,8 @@
#ifndef AVUTIL_ATOMIC_GCC_H
#define AVUTIL_ATOMIC_GCC_H
+#include <stdint.h>
+
#include "atomic.h"
#define avpriv_atomic_int_get atomic_int_get_gcc
@@ -47,7 +49,13 @@ static inline int atomic_int_add_and_fetch_gcc(volatile int *ptr, int inc)
static inline void *atomic_ptr_cas_gcc(void * volatile *ptr,
void *oldval, void *newval)
{
+#ifdef __ARMCC_VERSION
+ // armcc will throw an error if ptr is not an integer type
+ volatile uintptr_t *tmp = (volatile uintptr_t*)ptr;
+ return (void*)__sync_val_compare_and_swap(tmp, oldval, newval);
+#else
return __sync_val_compare_and_swap(ptr, oldval, newval);
+#endif
}
#endif /* AVUTIL_ATOMIC_GCC_H */