Updating byte order.

Use functions in endian.h to convert between host and big
or litte endian.
Redoing the byte order support.

It turns out that endian.h is not available on all systems, so
we rely on compiler intrinsics for byte reordering and build
the abstraction ourselves.