ntohs() and ntohl() equivalent?
IPAddress.HostToNetworkOrder and IPAddress.NetworkToHostOrder? Each method has overloads for 16, 32 and 64 bit integers.
IPAddress.HostToNetworkOrder and IPAddress.NetworkToHostOrder? Each method has overloads for 16, 32 and 64 bit integers.
#define htonll(x) ((1==htonl(1)) ? (x) : ((uint64_t)htonl((x) & 0xFFFFFFFF) << 32) | htonl((x) >> 32)) #define ntohll(x) ((1==ntohl(1)) ? (x) : ((uint64_t)ntohl((x) & 0xFFFFFFFF) << 32) | ntohl((x) >> 32)) The test (1==htonl(1)) simply determines (at runtime sadly) if the hardware architecture requires byte swapping. There aren’t any portable ways to determine at compile-time what … Read more