blob: 071001911eb8086176f262e23734447da58b041d (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
|
#include <endian.h>
#include <netinet/in.h>
unsigned short int htons(unsigned short int hostshort) {
#if __BYTE_ORDER==__LITTLE_ENDIAN
return ((hostshort>>8)&0xff) | (hostshort<<8);
#else
return hostshort;
#endif
}
unsigned short int ntohs(unsigned short int hostshort) __attribute__((weak,alias("htons")));
|