blob: b6be02ed9249a605208bc7bdd34fd426d81a3088 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
|
#include <arpa/inet.h>
uint16_t htons(uint16_t hostshort)
{
union {
uint16_t u;
unsigned char c[sizeof(uint16_t)];
} u;
u.c[0] = (hostshort >> 8) & 0xff;
u.c[1] = (hostshort) & 0xff;
return u.u;
}
|