Go to the documentation of this file.
24 #if defined(__linux__)
26 #include <netinet/in.h>
27 #include <asm/byteorder.h>
29 #define cf_swap_to_be16(_n) __cpu_to_be16(_n)
30 #define cf_swap_from_be16(_n) __be16_to_cpu(_n)
32 #define cf_swap_to_be32(_n) __cpu_to_be32(_n)
33 #define cf_swap_from_be32(_n) __be32_to_cpu(_n)
35 #define cf_swap_to_be64(_n) __cpu_to_be64(_n)
36 #define cf_swap_from_be64(_n) __be64_to_cpu(_n)
40 #if defined(__APPLE__)
41 #include <libkern/OSByteOrder.h>
42 #include <arpa/inet.h>
44 #define cf_swap_to_be16(_n) OSSwapHostToBigInt16(_n)
45 #define cf_swap_from_be16(_n) OSSwapBigToHostInt16(_n)
47 #define cf_swap_to_be32(_n) OSSwapHostToBigInt32(_n)
48 #define cf_swap_from_be32(_n) OSSwapBigToHostInt32(_n)
50 #define cf_swap_to_be64(_n) OSSwapHostToBigInt64(_n)
51 #define cf_swap_from_be64(_n) OSSwapBigToHostInt64(_n)
55 #if defined(CF_WINDOWS)
60 #define cf_swap_to_be16(_n) _byteswap_uint16(_n)
61 #define cf_swap_from_be16(_n) _byteswap_uint16(_n)
63 #define cf_swap_to_be32(_n) _byteswap_uint32(_n)
64 #define cf_swap_from_be32(_n) _byteswap_uint32(_n)
66 #define cf_swap_to_be64(_n) _byteswap_uint64(_n)
67 #define cf_swap_from_be64(_n) _byteswap_uint64(_n)