No empty .Rs/.Re
[netbsd-mini2440.git] / common / lib / libc / net / ntohl.c
blobe248ca531c56a989e80dd3165ef6944a4c479df7
1 /* $NetBSD: ntohl.c,v 1.10 2003/07/26 19:24:48 salo 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: ntohl.c,v 1.10 2003/07/26 19:24:48 salo Exp $");
11 #endif
13 #include <sys/types.h>
15 #undef ntohl
17 uint32_t
18 ntohl(x)
19 uint32_t x;
21 #if BYTE_ORDER == LITTLE_ENDIAN
22 u_char *s = (u_char *)&x;
23 return (uint32_t)(s[0] << 24 | s[1] << 16 | s[2] << 8 | s[3]);
24 #else
25 return x;
26 #endif