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

uint32_t htonl(uint32_t n)
{
	union {
		uint8_t b[4];
		uint32_t i;
	} u = { { n>>24, n>>16, n>>8, n } };
	return u.i;
}