]> git.kernelconcepts.de Git - karo-tx-linux.git/blobdiff - tools/testing/selftests/bpf/bpf_endian.h
Merge tag 'kvm-4.13-2' of git://git.kernel.org/pub/scm/virt/kvm/kvm
[karo-tx-linux.git] / tools / testing / selftests / bpf / bpf_endian.h
index 487cbfb89beb5012816c7e4989b3f9ff4261995d..74af266aa512baf256a33b6434b43a901612b934 100644 (file)
 # define __bpf_htons(x)                        __builtin_bswap16(x)
 # define __bpf_constant_ntohs(x)       ___constant_swab16(x)
 # define __bpf_constant_htons(x)       ___constant_swab16(x)
+# define __bpf_ntohl(x)                        __builtin_bswap32(x)
+# define __bpf_htonl(x)                        __builtin_bswap32(x)
+# define __bpf_constant_ntohl(x)       ___constant_swab32(x)
+# define __bpf_constant_htonl(x)       ___constant_swab32(x)
 #elif __BYTE_ORDER__ == __ORDER_BIG_ENDIAN__
 # define __bpf_ntohs(x)                        (x)
 # define __bpf_htons(x)                        (x)
 # define __bpf_constant_ntohs(x)       (x)
 # define __bpf_constant_htons(x)       (x)
+# define __bpf_ntohl(x)                        (x)
+# define __bpf_htonl(x)                        (x)
+# define __bpf_constant_ntohl(x)       (x)
+# define __bpf_constant_htonl(x)       (x)
 #else
 # error "Fix your compiler's __BYTE_ORDER__?!"
 #endif
 #define bpf_ntohs(x)                           \
        (__builtin_constant_p(x) ?              \
         __bpf_constant_ntohs(x) : __bpf_ntohs(x))
+#define bpf_htonl(x)                           \
+       (__builtin_constant_p(x) ?              \
+        __bpf_constant_htonl(x) : __bpf_htonl(x))
+#define bpf_ntohl(x)                           \
+       (__builtin_constant_p(x) ?              \
+        __bpf_constant_ntohl(x) : __bpf_ntohl(x))
 
 #endif /* __BPF_ENDIAN__ */