Eliminate an assortment of undefined behavior.

Hopefully, this fixes the PPC64 buildbots.