uatomic: add uatomic_or
[urcu.git] / tests / test_uatomic.c
index 68cb6df821d5037599ef5e787f33dedf47ccc85b..37f95a6d849699f7756676a09f0fee78803f4054 100644 (file)
@@ -2,18 +2,9 @@
 #include <assert.h>
 #include <urcu/uatomic_arch.h>
 
-#if (defined(__i386__) || defined(__x86_64__))
-#define HAS_ATOMIC_BYTE
-#define HAS_ATOMIC_SHORT
-#endif
-
 struct testvals {
-#ifdef HAS_ATOMIC_BYTE
        unsigned char c;
-#endif
-#ifdef HAS_ATOMIC_SHORT
        unsigned short s;
-#endif
        unsigned int i;
        unsigned long l;
 };
@@ -42,8 +33,10 @@ do {                                         \
        assert(uatomic_read(ptr) == 23);                \
        uatomic_dec(ptr);                       \
        assert(uatomic_read(ptr) == 22);                \
-       v = uatomic_add_return(ptr, 100);       \
-       assert(v == 122);                       \
+       v = uatomic_add_return(ptr, 74);        \
+       assert(v == 96);                        \
+       assert(uatomic_read(ptr) == 96);        \
+       uatomic_or(ptr, 58);                    \
        assert(uatomic_read(ptr) == 122);       \
        v = uatomic_sub_return(ptr, 1);         \
        assert(v == 121);                       \
@@ -52,10 +45,10 @@ do {                                                \
 
 int main(int argc, char **argv)
 {
-#ifdef HAS_ATOMIC_BYTE
+#ifdef UATOMIC_HAS_ATOMIC_BYTE
        do_test(&vals.c);
 #endif
-#ifdef HAS_ATOMIC_SHORT
+#ifdef UATOMIC_HAS_ATOMIC_SHORT
        do_test(&vals.s);
 #endif
        do_test(&vals.i);
This page took 0.023645 seconds and 4 git commands to generate.