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/htons.c | 10 ++++++++++ 1 file changed, 10 insertions(+) create mode 100644 src/network/htons.c (limited to 'src/network/htons.c') diff --git a/src/network/htons.c b/src/network/htons.c new file mode 100644 index 00000000..522504a5 --- /dev/null +++ b/src/network/htons.c @@ -0,0 +1,10 @@ +#include + +uint16_t htons(uint16_t n) +{ + union { + uint8_t b[2]; + uint16_t s; + } u = { { n>>8, n } }; + return u.s; +} -- cgit v1.2.1