summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/atomic_ops/sysdeps/gcc/aarch64.h1
-rw-r--r--src/atomic_ops/sysdeps/gcc/nios2.h2
-rw-r--r--src/atomic_ops/sysdeps/test_and_set_t_is_ao_t.h13
-rw-r--r--src/atomic_ops/sysdeps/test_and_set_t_is_char.h18
4 files changed, 28 insertions, 6 deletions
diff --git a/src/atomic_ops/sysdeps/gcc/aarch64.h b/src/atomic_ops/sysdeps/gcc/aarch64.h
index 612bc18..d3508a6 100644
--- a/src/atomic_ops/sysdeps/gcc/aarch64.h
+++ b/src/atomic_ops/sysdeps/gcc/aarch64.h
@@ -15,6 +15,7 @@
*
*/
+#define AO_GCC_ATOMIC_TEST_AND_SET
#include "../test_and_set_t_is_ao_t.h"
#include "../standard_ao_double_t.h"
diff --git a/src/atomic_ops/sysdeps/gcc/nios2.h b/src/atomic_ops/sysdeps/gcc/nios2.h
index f402cbb..a7f2ef8 100644
--- a/src/atomic_ops/sysdeps/gcc/nios2.h
+++ b/src/atomic_ops/sysdeps/gcc/nios2.h
@@ -11,7 +11,9 @@
* modified is included with the above copyright notice.
*/
+#define AO_GCC_ATOMIC_TEST_AND_SET
#include "../test_and_set_t_is_ao_t.h"
+
#include "generic.h"
#define AO_T_IS_INT
diff --git a/src/atomic_ops/sysdeps/test_and_set_t_is_ao_t.h b/src/atomic_ops/sysdeps/test_and_set_t_is_ao_t.h
index 606f7ac..d05f498 100644
--- a/src/atomic_ops/sysdeps/test_and_set_t_is_ao_t.h
+++ b/src/atomic_ops/sysdeps/test_and_set_t_is_ao_t.h
@@ -23,10 +23,17 @@
/*
* These are common definitions for architectures on which test_and_set
* operates on pointer-sized quantities, the "clear" value contains
- * all zeroes, and the "set" value contains only one lowest bit set.
- * This can be used if test_and_set is synthesized from compare_and_swap.
+ * all zeroes, and the "set" value contains only one lowest bit set typically.
*/
-typedef enum {AO_TS_clear = 0, AO_TS_set = 1} AO_TS_val;
+
+#if defined(AO_GCC_ATOMIC_TEST_AND_SET) && !defined(AO_PREFER_GENERALIZED) \
+ && defined(__GCC_ATOMIC_TEST_AND_SET_TRUEVAL)
+# define AO_TS_SET_TRUEVAL __GCC_ATOMIC_TEST_AND_SET_TRUEVAL
+#else
+# define AO_TS_SET_TRUEVAL 1
+#endif
+
+typedef enum { AO_TS_clear = 0, AO_TS_set = AO_TS_SET_TRUEVAL } AO_TS_val;
#define AO_TS_VAL_t AO_TS_val
#define AO_TS_CLEAR AO_TS_clear
#define AO_TS_SET AO_TS_set
diff --git a/src/atomic_ops/sysdeps/test_and_set_t_is_char.h b/src/atomic_ops/sysdeps/test_and_set_t_is_char.h
index 8e265aa..1711ffd 100644
--- a/src/atomic_ops/sysdeps/test_and_set_t_is_char.h
+++ b/src/atomic_ops/sysdeps/test_and_set_t_is_char.h
@@ -23,13 +23,25 @@
/*
* These are common definitions for architectures on which test_and_set
* operates on byte sized quantities, the "clear" value contains
- * all zeroes, and the "set" value contains all ones.
+ * all zeroes, and the "set" value contains all ones typically.
*/
-#define AO_TS_t unsigned char
-typedef enum {AO_BYTE_TS_clear = 0, AO_BYTE_TS_set = 0xff} AO_BYTE_TS_val;
+#if defined(AO_GCC_ATOMIC_TEST_AND_SET) && !defined(AO_PREFER_GENERALIZED) \
+ && defined(__GCC_ATOMIC_TEST_AND_SET_TRUEVAL)
+# define AO_TS_SET_TRUEVAL __GCC_ATOMIC_TEST_AND_SET_TRUEVAL
+#else
+# define AO_TS_SET_TRUEVAL 0xff
+#endif
+
+typedef enum {
+ AO_BYTE_TS_clear = 0,
+ AO_BYTE_TS_set = AO_TS_SET_TRUEVAL
+} AO_BYTE_TS_val;
+
#define AO_TS_VAL_t AO_BYTE_TS_val
#define AO_TS_CLEAR AO_BYTE_TS_clear
#define AO_TS_SET AO_BYTE_TS_set
+#define AO_TS_t unsigned char
+
#define AO_CHAR_TS_T 1