static inline bool test_and_set(bool *x, bool v) { asm volatile ( "swpb %0, %0, [%1]\n" : "+r"(v) : "r"(x) ); return v; }