Patch from Robert P. Day, moving byte order checks to use platform.h macros.