summaryrefslogtreecommitdiff
path: root/lib/libc/arpa/ntohl.c
blob: 0adcbc5f3b963198277af1a67c33a9c6617631c9 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
#include <arpa/inet.h>
#include <byteswap.h>

uint32_t ntohl(uint32_t netlong)
{
	union {
		int i;
		char c;
	} u = { 1 };

	return u.c ? bswap32(netlong) : netlong;
}