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 12var ( 13 // NativeEndian is the machine native endian implementation of 14 // ByteOrder. 15 NativeEndian binary.ByteOrder 16 17 kernelAlign int 18) 19 20func init() { 21 i := uint32(1) 22 b := (*[4]byte)(unsafe.Pointer(&i)) 23 if b[0] == 1 { 24 NativeEndian = binary.LittleEndian 25 } else { 26 NativeEndian = binary.BigEndian 27 } 28 kernelAlign = probeProtocolStack() 29} 30 31func roundup(l int) int { 32 return (l + kernelAlign - 1) &^ (kernelAlign - 1) 33} 34