Implement endianness conversion