2 #include <arch_atomic.h>
12 static struct testvals vals
;
14 #define do_test(ptr) \
16 __typeof__(*(ptr)) v; \
18 atomic_add(ptr, 10); \
19 assert(*(ptr) == 10); \
20 atomic_add(ptr, -11UL); \
21 assert(*(ptr) == (__typeof__(*(ptr)))-1UL); \
22 v = cmpxchg(ptr, -1UL, 22); \
23 assert(*(ptr) == 22); \
24 assert(v == (__typeof__(*(ptr)))-1UL); \
25 v = cmpxchg(ptr, 33, 44); \
26 assert(*(ptr) == 22); \
29 assert(*(ptr) == 55); \
33 int main(int argc
, char **argv
)
39 printf("Atomic ops test OK\n");
This page took 0.04907 seconds and 5 git commands to generate.