github.com/metacubex/mihomo@v1.18.5/component/ebpf/byteorder/byteorder_littleendian.go (about) 1 //go:build 386 || amd64 || amd64p32 || arm || arm64 || mips64le || mips64p32le || mipsle || ppc64le || riscv64 || loong64 2 3 package byteorder 4 5 import ( 6 "encoding/binary" 7 "math/bits" 8 ) 9 10 var Native binary.ByteOrder = binary.LittleEndian 11 12 func HostToNetwork16(u uint16) uint16 { return bits.ReverseBytes16(u) } 13 func HostToNetwork32(u uint32) uint32 { return bits.ReverseBytes32(u) } 14 func NetworkToHost16(u uint16) uint16 { return bits.ReverseBytes16(u) } 15 func NetworkToHost32(u uint32) uint32 { return bits.ReverseBytes32(u) }