summaryrefslogtreecommitdiff
path: root/src/network/ntohs.c
blob: 3544a4798cfc43ea3f6fe8cddd698c78d66a0279 (plain)
1
2
3
4
5
6
7
8
9
10
#include <netinet/in.h>

uint16_t ntohs(uint16_t n)
{
	union {
		uint16_t s;
		uint8_t b[2];
	} u = { n };
	return (u.b[0]<<8) | u.b[1];
}