mirror of
https://github.com/k3s-io/k3s.git
synced 2024-06-07 19:41:36 +00:00
e204d863a5
* Update Kubernetes to v1.22.1 * Update dependent modules to track with upstream Signed-off-by: Brad Davidson <brad.davidson@rancher.com>
30 lines
595 B
Go
30 lines
595 B
Go
package internal
|
|
|
|
import (
|
|
"encoding/binary"
|
|
"unsafe"
|
|
)
|
|
|
|
// NativeEndian is set to either binary.BigEndian or binary.LittleEndian,
|
|
// depending on the host's endianness.
|
|
var NativeEndian binary.ByteOrder
|
|
|
|
// Clang is set to either "el" or "eb" depending on the host's endianness.
|
|
var ClangEndian string
|
|
|
|
func init() {
|
|
if isBigEndian() {
|
|
NativeEndian = binary.BigEndian
|
|
ClangEndian = "eb"
|
|
} else {
|
|
NativeEndian = binary.LittleEndian
|
|
ClangEndian = "el"
|
|
}
|
|
}
|
|
|
|
func isBigEndian() (ret bool) {
|
|
i := int(0x1)
|
|
bs := (*[int(unsafe.Sizeof(i))]byte)(unsafe.Pointer(&i))
|
|
return bs[0] == 0
|
|
}
|