plasma_atomic - portable atomic compare-and-swap