Extended Berkeley Packet Filter (eBPF) assembler and virtual machine
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 

35 lines
755 B

// +build 386 amd64 amd64p32 arm arm64 ppc64le mipsle mips64le mips64p32le
package ebpf
func htobe16(n uint16) uint16 {
return (n&0x00FF)<<8 | (n&0xFF00)>>8
}
func htobe32(n uint32) uint32 {
return (n&0x000000FF)<<24 | (n&0x0000FF00)<<8 |
(n&0x00FF0000)>>8 | (n&0xFF000000)>>24
}
func htobe64(n uint64) uint64 {
return ((n & 0x00000000000000FF) << 56) |
((n & 0x000000000000FF00) << 40) |
((n & 0x0000000000FF0000) << 24) |
((n & 0x00000000FF000000) << 8) |
((n & 0x000000FF00000000) >> 8) |
((n & 0x0000FF0000000000) >> 24) |
((n & 0x00FF000000000000) >> 40) |
((n & 0xFF00000000000000) >> 56)
}
func htole16(n uint16) uint16 {
return n
}
func htole32(n uint32) uint32 {
return n
}
func htole64(n uint64) uint64 {
return n
}