Skip to content

Commit

Permalink
Hard code endianness
Browse files Browse the repository at this point in the history
  • Loading branch information
brycekahle committed May 2, 2022
1 parent 5fd10f5 commit afd6cca
Show file tree
Hide file tree
Showing 3 changed files with 30 additions and 1 deletion.
5 changes: 4 additions & 1 deletion internal/endian.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
//go:build !386 && !amd64 && !amd64p32 && !arm && !arm64 && !mipsle && !mips64le && !mips64p32le && !ppc64le && !riscv64 && !armbe && !arm64be && !mips && !mips64 && !mips64p32 && !ppc64 && !s390 && !s390x && !sparc && !sparc64
// +build !386,!amd64,!amd64p32,!arm,!arm64,!mipsle,!mips64le,!mips64p32le,!ppc64le,!riscv64,!armbe,!arm64be,!mips,!mips64,!mips64p32,!ppc64,!s390,!s390x,!sparc,!sparc64

package internal

import (
Expand All @@ -9,7 +12,7 @@ import (
// depending on the host's endianness.
var NativeEndian binary.ByteOrder

// Clang is set to either "el" or "eb" depending on the host's endianness.
// ClangEndian is set to either "el" or "eb" depending on the host's endianness.
var ClangEndian string

func init() {
Expand Down
13 changes: 13 additions & 0 deletions internal/endian_be.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
//go:build armbe || arm64be || mips || mips64 || mips64p32 || ppc64 || s390 || s390x || sparc || sparc64
// +build armbe arm64be mips mips64 mips64p32 ppc64 s390 s390x sparc sparc64

package internal

import "encoding/binary"

// NativeEndian is set to either binary.BigEndian or binary.LittleEndian,
// depending on the host's endianness.
var NativeEndian binary.ByteOrder = binary.BigEndian

// ClangEndian is set to either "el" or "eb" depending on the host's endianness.
const ClangEndian = "eb"
13 changes: 13 additions & 0 deletions internal/endian_le.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
//go:build 386 || amd64 || amd64p32 || arm || arm64 || mipsle || mips64le || mips64p32le || ppc64le || riscv64
// +build 386 amd64 amd64p32 arm arm64 mipsle mips64le mips64p32le ppc64le riscv64

package internal

import "encoding/binary"

// NativeEndian is set to either binary.BigEndian or binary.LittleEndian,
// depending on the host's endianness.
var NativeEndian binary.ByteOrder = binary.LittleEndian

// ClangEndian is set to either "el" or "eb" depending on the host's endianness.
const ClangEndian = "el"

0 comments on commit afd6cca

Please sign in to comment.