Create a helper function that does endian check.