Kamil M / cantcoap3
Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers inet.h Source File

inet.h

00001 
00002 uint16_t htons (uint16_t x) {
00003 #if BYTE_ORDER == BIG_ENDIAN
00004   return x;
00005 #elif BYTE_ORDER == LITTLE_ENDIAN
00006   return __bswap_16 (x);
00007 #else
00008 # error "What kind of system is this?"
00009 #endif
00010 }
00011 
00012 uint16_t ntohs (uint16_t x) {
00013 #if BYTE_ORDER == BIG_ENDIAN
00014   return x;
00015 #elif BYTE_ORDER == LITTLE_ENDIAN
00016   return __bswap_16 (x);
00017 #else
00018 # error "What kind of system is this?"
00019 #endif
00020 }