summaryrefslogtreecommitdiff
path: root/src/arpa/inet/ntohs.c
blob: 20d117d21eb511f04d90793e2747a41ddef74b4b (plain)
1
2
3
4
5
6
7
8
9
10
11
#include <arpa/inet.h>

uint16_t ntohs(uint16_t netshort)
{
	union {
		uint16_t u;
		unsigned char c[sizeof(uint16_t)];
	} u = { netshort };

	return (u.c[0] << 8) | u.c[1];
}