diff options
Diffstat (limited to 'libc/upstream-openbsd/lib/libc/net/htonl.c')
-rw-r--r-- | libc/upstream-openbsd/lib/libc/net/htonl.c | 14 |
1 files changed, 4 insertions, 10 deletions
diff --git a/libc/upstream-openbsd/lib/libc/net/htonl.c b/libc/upstream-openbsd/lib/libc/net/htonl.c index 6ee6e7efb..58bfb4699 100644 --- a/libc/upstream-openbsd/lib/libc/net/htonl.c +++ b/libc/upstream-openbsd/lib/libc/net/htonl.c @@ -1,6 +1,5 @@ -/* $OpenBSD: htonl.c,v 1.7 2014/07/21 01:51:10 guenther Exp $ */ +/* $OpenBSD: htonl.c,v 1.8 2024/04/15 14:30:48 naddy Exp $ */ /* - * Written by J.T. Conklin <jtc@netbsd.org>. * Public domain. */ @@ -9,13 +8,8 @@ #undef htonl -u_int32_t -htonl(u_int32_t x) +uint32_t +htonl(uint32_t x) { -#if BYTE_ORDER == LITTLE_ENDIAN - u_char *s = (u_char *)&x; - return (u_int32_t)(s[0] << 24 | s[1] << 16 | s[2] << 8 | s[3]); -#else - return x; -#endif + return htobe32(x); } |