2 /* native endian 2 big endian */
5 inline C ne2be (C value) // native endian to big endian (htonl ())
7 return static_cast<C> (htonl (static_cast<long> (value)));
11 inline short ne2be (short value) // specialization for short (htons ())
13 return static_cast<short> (htons (static_cast<short> (value)));
17 inline unsigned short ne2be (unsigned short value) // specialization for unsigned short (htons ())
19 return static_cast<unsigned short> (htons (static_cast<unsigned short> (value)));
22 /* big endian 2 native endian */
25 inline C be2ne (C value) // big endian to native endian (ntohl ())
27 return static_cast<C> (ntohl (static_cast<long> (value)));
31 inline short be2ne (short value) // specialization for short (ntohs ())
33 return static_cast<short> (ntohs (static_cast<short> (value)));
37 inline unsigned short be2ne (unsigned short value) // specialization for unsigned short (ntohs ())
39 return static_cast<unsigned short> (ntohs (static_cast<unsigned short> (value)));