Fix for bug #3469 CV_XADD failing in clang+nvcc combination

Taken from 3f0765523113ae7fc1b300f27dd78c642bb2b6c7
Merge pull request #3255 from bhack:fix_cuda_macosx