summaryrefslogtreecommitdiff
path: root/sys/lib/libkern/htonl.c
diff options
context:
space:
mode:
Diffstat (limited to 'sys/lib/libkern/htonl.c')
-rw-r--r--sys/lib/libkern/htonl.c16
1 files changed, 6 insertions, 10 deletions
diff --git a/sys/lib/libkern/htonl.c b/sys/lib/libkern/htonl.c
index 38faf1309f5..ad1b47b98d2 100644
--- a/sys/lib/libkern/htonl.c
+++ b/sys/lib/libkern/htonl.c
@@ -1,14 +1,11 @@
-/* $OpenBSD: htonl.c,v 1.4 2004/08/07 00:38:32 deraadt Exp $ */
-/* $NetBSD: htonl.c,v 1.6.6.1 1996/05/29 23:47:55 cgd Exp $ */
-
/*
* Written by J.T. Conklin <jtc@netbsd.org>.
* Public domain.
*/
#if defined(LIBC_SCCS) && !defined(lint)
-static char *rcsid = "$NetBSD: htonl.c,v 1.6.6.1 1996/05/29 23:47:55 cgd Exp $";
-#endif
+static char *rcsid = "$OpenBSD: htonl.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: htonl.c,v 1.6.6.1 1996/05/29 23:47:55 cgd Exp $";
#undef htonl
u_int32_t
-htonl(u_int32_t x)
+htonl(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
}