Fix integer overflow issues on 64-bit OS X.