Drop main() prototype. Syncs with NetBSD-8
[minix.git] / common / lib / libc / net / htonl.c
blob8fc35967e1c2d59dd4dfa6b9b1cba6c7531f3114
1 /* $NetBSD: htonl.c,v 1.3 2012/03/21 20:02:56 he Exp $ */
3 /*
4 * Written by J.T. Conklin <jtc@NetBSD.org>.
5 * Public domain.
6 */
8 #include <sys/cdefs.h>
9 #if defined(LIBC_SCCS) && !defined(lint)
10 __RCSID("$NetBSD: htonl.c,v 1.3 2012/03/21 20:02:56 he Exp $");
11 #endif
13 #include <sys/types.h>
15 #undef htonl
17 uint32_t
18 htonl(uint32_t x)
20 #if BYTE_ORDER == LITTLE_ENDIAN
21 u_char *s = (void *)&x;
22 return (uint32_t)(s[0] << 24 | s[1] << 16 | s[2] << 8 | s[3]);
23 #else
24 return x;
25 #endif