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

uint16_t htons(uint16_t n)
{
	union {
		uint8_t b[2];
		uint16_t s;
	} u = { { n>>8, n } };
	return u.s;
}