Fix bug in big-endian path and optimize it for size.