Build fixes for ppc64 and x86_64, and fixes needed now that we use -Wshorten-64-to-32.