Changed to runtime endian detection, this can't fail and shouldn't be slower than macros if the compiler inlines properly