#include #include int main() { { long x = 3; long bit = 0; printf("Testing bit %ld of x=%ld\n", bit, x); bool ret = boost::detail::win32::interlocked_bit_test_and_set(&x, bit); printf("result: %d (expected: 1)\n", ret ? 1 : 0); printf("x: %ld (expected: 3)\n", x); } { long x = 3; long bit = 2; printf("Testing bit %ld of x=%ld\n", bit, x); bool ret = boost::detail::win32::interlocked_bit_test_and_set(&x, bit); printf("result: %d (expected: 0)\n", ret ? 1 : 0); printf("x: %ld (expected: 7)\n", x); } return 0; }