From c8939ab7c79e0e9048ae8320259f92468a8d7b60 Mon Sep 17 00:00:00 2001 From: Brad Fitzpatrick Date: Tue, 17 Nov 2020 13:37:06 -0800 Subject: [PATCH] util/endian: add Native variable to get the platform's native binary.ByteOrder Signed-off-by: Brad Fitzpatrick --- util/endian/big.go | 5 +++++ util/endian/little.go | 5 +++++ 2 files changed, 10 insertions(+) diff --git a/util/endian/big.go b/util/endian/big.go index 0dcdbab1f..d0be83b81 100644 --- a/util/endian/big.go +++ b/util/endian/big.go @@ -6,5 +6,10 @@ package endian +import "encoding/binary" + // Big is whether the current platform is big endian. const Big = true + +// Native is the platform's native byte order. +var Native = binary.BigEndian diff --git a/util/endian/little.go b/util/endian/little.go index dd8686356..78c85a427 100644 --- a/util/endian/little.go +++ b/util/endian/little.go @@ -6,5 +6,10 @@ package endian +import "encoding/binary" + // Big is whether the current platform is big endian. const Big = false + +// Native is the platform's native byte order. +var Native = binary.LittleEndian