Cleanup of the byteorder patch

This version of the patch, while technically the same, is a little
cleaner in code. It seems to be working on NetBSD, MOX and Linux.