util/endian: add Native variable to get the platform's native binary.ByteOrder

Signed-off-by: Brad Fitzpatrick <bradfitz@tailscale.com>
This commit is contained in:
Brad Fitzpatrick 2020-11-17 13:37:06 -08:00 committed by Brad Fitzpatrick
parent 883a11f2a8
commit c8939ab7c7
2 changed files with 10 additions and 0 deletions

View File

@ -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

View File

@ -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