...

Source file src/pkg/vendor/golang.org/x/sys/cpu/byteorder.go

     1	// Copyright 2019 The Go Authors. All rights reserved.
     2	// Use of this source code is governed by a BSD-style
     3	// license that can be found in the LICENSE file.
     4	
     5	package cpu
     6	
     7	import (
     8		"encoding/binary"
     9		"runtime"
    10	)
    11	
    12	// hostByteOrder returns binary.LittleEndian on little-endian machines and
    13	// binary.BigEndian on big-endian machines.
    14	func hostByteOrder() binary.ByteOrder {
    15		switch runtime.GOARCH {
    16		case "386", "amd64", "amd64p32",
    17			"arm", "arm64",
    18			"mipsle", "mips64le", "mips64p32le",
    19			"ppc64le",
    20			"riscv", "riscv64":
    21			return binary.LittleEndian
    22		case "armbe", "arm64be",
    23			"mips", "mips64", "mips64p32",
    24			"ppc", "ppc64",
    25			"s390", "s390x",
    26			"sparc", "sparc64":
    27			return binary.BigEndian
    28		}
    29		panic("unknown architecture")
    30	}
    31	

View as plain text