From 0b44a0315b47dd8eced9f3b7f31580cf14bbfc01 Mon Sep 17 00:00:00 2001 From: Rich Felker Date: Sat, 12 Feb 2011 00:22:29 -0500 Subject: initial check-in, version 0.5.0 --- src/network/ntohl.c | 10 ++++++++++ 1 file changed, 10 insertions(+) create mode 100644 src/network/ntohl.c (limited to 'src/network/ntohl.c') diff --git a/src/network/ntohl.c b/src/network/ntohl.c new file mode 100644 index 00000000..64379196 --- /dev/null +++ b/src/network/ntohl.c @@ -0,0 +1,10 @@ +#include + +uint32_t ntohl(uint32_t n) +{ + union { + uint32_t i; + uint8_t b[4]; + } u = { n }; + return (u.b[0]<<24) | (u.b[1]<<16) | (u.b[2]<<8) | u.b[3]; +} -- cgit v1.2.1