Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Hard code endianness #649

Closed
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
brycekahle marked this conversation as resolved.
Show resolved Hide resolved

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