From d846855da8c8142a2f647f7a4c6949b341261297 Mon Sep 17 00:00:00 2001 From: Mike Barcroft Date: Sat, 9 Mar 2002 21:02:16 +0000 Subject: o Don't require long long support in bswap64() functions. o In i386's , macros have some advantages over inlines, so change some inlines to macros. o In i386's , ungarbage collect word_swap_int() (previously __uint16_swap_uint32), it has some uses on i386's with PDP endianness. Submitted by: bde o Move a comment up in that was accidentially moved down a few revisions ago. o Reenable userland's use of optimized inline-asm versions of byteorder(3) functions. o Fix ordering of prototypes vs. redefinition of byteorder(3) functions, so that the non-GCC (libc asm) case has proper prototypes. o Add proper prototypes for byteorder(3) functions in . o Prevent redundant duplicate prototypes by making use of the _BYTEORDER_PROTOTYPED define. o Move the bswap16(), bswap32(), bswap64() C functions into MD space for platforms in which asm versions don't exist. This significantly reduces the complexity of some things at the cost of duplicate code. Reviewed by: bde --- lib/libstand/stand.h | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) (limited to 'lib/libstand') diff --git a/lib/libstand/stand.h b/lib/libstand/stand.h index e3570f9a9ee4..fcbb2e849b7d 100644 --- a/lib/libstand/stand.h +++ b/lib/libstand/stand.h @@ -374,15 +374,21 @@ extern struct devsw *devsw[]; /* * Expose byteorder(3) functions. */ -#define htonl(x) __htonl(x) -#define htons(x) __htons(x) -#define ntohl(x) __ntohl(x) -#define ntohs(x) __ntohs(x) - +#ifndef _BYTEORDER_PROTOTYPED +#define _BYTEORDER_PROTOTYPED extern uint32_t htonl(uint32_t); extern uint16_t htons(uint16_t); extern uint32_t ntohl(uint32_t); extern uint16_t ntohs(uint16_t); +#endif + +#ifndef _BYTEORDER_FUNC_DEFINED +#define _BYTEORDER_FUNC_DEFINED +#define htonl(x) __htonl(x) +#define htons(x) __htons(x) +#define ntohl(x) __ntohl(x) +#define ntohs(x) __ntohs(x) +#endif #if 0 -- cgit v1.3