1// Copyright 2017 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 5package socket 6 7import ( 8 "encoding/binary" 9 "unsafe" 10) 11 12// NativeEndian is the machine native endian implementation of ByteOrder. 13var NativeEndian binary.ByteOrder 14 15func init() { 16 i := uint32(1) 17 b := (*[4]byte)(unsafe.Pointer(&i)) 18 if b[0] == 1 { 19 NativeEndian = binary.LittleEndian 20 } else { 21 NativeEndian = binary.BigEndian 22 } 23} 24