I think I would make `non_native_endian` a template argument as well; this forces the compiler to generate separate functions for both cases.