Should 64bit Compare&Swap (CAS) work on a 32bit machine? (or 64bit machine?)
So I read that in a 32bit machine, one can use the CAS operation with aligned 64bit blocks. Similarly, in a 64bit machine, one can use the CAS operation with aligned 128bit blocks. I'm using a 32bit machine so I tried the following: // sizeof(long long) is 8 bytes, so 64 bits long long y = 12; long long z = 12; long long x = 99; __sync_bool_compare_and_swap(&y, z, x); and the CAS succeeded changing the value of y to 99 . But then I tried using a char array[8]; (which size is 64 bits) instead of a long long . And I do: char full[8] = {'0', '1', '2', '3', '4', '5', '6', '7'}; char full2[8] = {'0