aboutsummaryrefslogtreecommitdiff
path: root/src/network/htons.c
blob: 0775923379829ba8b58fc824eb5e11f5b0c38dfb (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
#include <netinet/in.h>
#include <byteswap.h>

uint16_t htons(uint16_t n)
{
	union { int i; char c; } u = { 1 };
	return u.c ? bswap_16(n) : n;
}


#ifdef TEST
int
main(void) {
	return 0;
}
#endif