diff options
author | 2004-11-28 07:23:41 +0000 | |
---|---|---|
committer | 2004-11-28 07:23:41 +0000 | |
commit | f6a3c9b1fa71b1a71957242d0da17e5e1f46240e (patch) | |
tree | 923ecdd7af5dbaae56d4af536e50c2c9c2c46dba /sys/lib/libkern/ntohl.c | |
parent | a tiny hppa64 bit (diff) | |
download | wireguard-openbsd-f6a3c9b1fa71b1a71957242d0da17e5e1f46240e.tar.xz wireguard-openbsd-f6a3c9b1fa71b1a71957242d0da17e5e1f46240e.zip |
sync from libc
Diffstat (limited to 'sys/lib/libkern/ntohl.c')
-rw-r--r-- | sys/lib/libkern/ntohl.c | 16 |
1 files changed, 6 insertions, 10 deletions
diff --git a/sys/lib/libkern/ntohl.c b/sys/lib/libkern/ntohl.c index 081b9d2858b..08176301eea 100644 --- a/sys/lib/libkern/ntohl.c +++ b/sys/lib/libkern/ntohl.c @@ -1,14 +1,11 @@ -/* $OpenBSD: ntohl.c,v 1.4 2004/08/07 00:38:32 deraadt Exp $ */ -/* $NetBSD: ntohl.c,v 1.6.6.1 1996/05/29 23:48:07 cgd Exp $ */ - /* * Written by J.T. Conklin <jtc@netbsd.org>. * Public domain. */ #if defined(LIBC_SCCS) && !defined(lint) -static char *rcsid = "$NetBSD: ntohl.c,v 1.6.6.1 1996/05/29 23:48:07 cgd Exp $"; -#endif +static char *rcsid = "$OpenBSD: ntohl.c,v 1.5 2004/11/28 07:23:41 mickey Exp $"; +#endif /* LIBC_SCCS and not lint */ #include <sys/types.h> #include <machine/endian.h> @@ -16,14 +13,13 @@ static char *rcsid = "$NetBSD: ntohl.c,v 1.6.6.1 1996/05/29 23:48:07 cgd Exp $"; #undef ntohl u_int32_t -ntohl(u_int32_t x) +ntohl(x) + u_int32_t x; { - u_int32_t y = x; - #if BYTE_ORDER == LITTLE_ENDIAN - u_char *s = (u_char *)&y; + u_char *s = (u_char *)&x; return (u_int32_t)(s[0] << 24 | s[1] << 16 | s[2] << 8 | s[3]); #else - return y; + return x; #endif } |