Use slightly more portable versions of compiler intrinsics
Rework test so that clang can compile them