portability casts and 64-bit intrinsics on Mac OSX