endian.hpp
Go to the documentation of this file.
1 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
24 #ifndef NDN_ENCODING_ENDIAN_HPP
25 #define NDN_ENCODING_ENDIAN_HPP
26 
27 #ifdef __linux__
28 
29 #include <endian.h>
30 
31 #endif // __linux__
32 
33 #ifdef __FreeBSD__
34 
35 #include <sys/endian.h>
36 
37 #endif // __FreeBSD__
38 
39 #ifdef __APPLE__
40 
41 #include <libkern/OSByteOrder.h>
42 #define htobe16(x) OSSwapHostToBigInt16(x)
43 #define htole16(x) OSSwapHostToLittleInt16(x)
44 #define be16toh(x) OSSwapBigToHostInt16(x)
45 #define le16toh(x) OSSwapLittleToHostInt16(x)
46 #define htobe32(x) OSSwapHostToBigInt32(x)
47 #define htole32(x) OSSwapHostToLittleInt32(x)
48 #define be32toh(x) OSSwapBigToHostInt32(x)
49 #define le32toh(x) OSSwapLittleToHostInt32(x)
50 #define htobe64(x) OSSwapHostToBigInt64(x)
51 #define htole64(x) OSSwapHostToLittleInt64(x)
52 #define be64toh(x) OSSwapBigToHostInt64(x)
53 #define le64toh(x) OSSwapLittleToHostInt64(x)
54 
55 #endif // __APPLE__
56 
57 #endif // NDN_ENCODING_ENDIAN_HPP