test_atomic: test for byte/short atomic support
authorMathieu Desnoyers <mathieu.desnoyers@polymtl.ca>
Thu, 24 Sep 2009 00:00:58 +0000 (20:00 -0400)
committerMathieu Desnoyers <mathieu.desnoyers@polymtl.ca>
Thu, 24 Sep 2009 00:00:58 +0000 (20:00 -0400)
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@polymtl.ca>
tests/test_atomic.c

index 102012fe2429008cf28f9736ec1b074f7fa00c8f..585c8ca86fbca43597dabd2d2a68569173479c4e 100644 (file)
@@ -2,9 +2,18 @@
 #include <arch_atomic.h>
 #include <assert.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;
 };
@@ -43,8 +52,12 @@ do {                                         \
 
 int main(int argc, char **argv)
 {
+#ifdef HAS_ATOMIC_BYTE
        do_test(&vals.c);
+#endif
+#ifdef HAS_ATOMIC_SHORT
        do_test(&vals.s);
+#endif
        do_test(&vals.i);
        do_test(&vals.l);
        printf("Atomic ops test OK\n");
This page took 0.025818 seconds and 4 git commands to generate.