#define TEST_AND_SET(x, v) \ ({ \ bool x; \ asm volatile ( \ "swpb %1, %1, [%0] \n\t" \ : "=m"(x) : "m"(x), "r"(v) \ ); \ x; \ })