diff options
author | mike <mike@FreeBSD.org> | 2001-08-30 00:04:19 +0000 |
---|---|---|
committer | mike <mike@FreeBSD.org> | 2001-08-30 00:04:19 +0000 |
commit | a45063618a1d6723c7f698850318bdd8b65f27a0 (patch) | |
tree | 2a398220f9e238744c0dfb240b714a2129e1c526 /sys/i386 | |
parent | 77d67fb5682dc550f62559210baf33988ee0f890 (diff) | |
download | FreeBSD-src-a45063618a1d6723c7f698850318bdd8b65f27a0.zip FreeBSD-src-a45063618a1d6723c7f698850318bdd8b65f27a0.tar.gz |
o Remove some GCCisms in src/powerpc/include/endian.h.
o Unify <machine/endian.h>'s across all architectures.
o Make bswapXX() functions use a different spelling of u_int16_t and
friends to reduce namespace pollution. The bswapXX() functions
don't actually exist, but we'll probably import these at some
point. Atleast one driver (if_de) depends on bswapXX() for big
endian cases.
o Deprecate byteorder(3) prototypes from <sys/types.h>, these are
now prototyped indirectly in <arpa/inet.h>.
o Deprecate in_addr_t and in_port_t typedefs in <sys/types.h>, these
are now typedef'd in <arpa/inet.h>.
o Change byteorder(3) prototypes to use standards compliant uint32_t
(spelled __uint32_t to reduce namespace pollution).
o Document new preferred headers and standards compliance.
Discussed with: bde
PR: 29946
Reviewed by: bmilekic
Diffstat (limited to 'sys/i386')
-rw-r--r-- | sys/i386/include/ansi.h | 2 | ||||
-rw-r--r-- | sys/i386/include/endian.h | 21 |
2 files changed, 13 insertions, 10 deletions
diff --git a/sys/i386/include/ansi.h b/sys/i386/include/ansi.h index c375f31..3aff58e 100644 --- a/sys/i386/include/ansi.h +++ b/sys/i386/include/ansi.h @@ -48,6 +48,8 @@ */ #define _BSD_CLOCK_T_ unsigned long /* clock()... */ #define _BSD_CLOCKID_T_ int /* clock_gettime()... */ +#define _BSD_IN_ADDR_T_ __uint32_t /* inet(3) functions */ +#define _BSD_IN_PORT_T_ __uint16_t #define _BSD_MBSTATE_T_ __mbstate_t /* mbstate_t */ #define _BSD_PTRDIFF_T_ int /* ptr1 - ptr2 */ #define _BSD_RUNE_T_ _BSD_CT_RUNE_T_ /* rune_t (see below) */ diff --git a/sys/i386/include/endian.h b/sys/i386/include/endian.h index 41ceda4..f929b64 100644 --- a/sys/i386/include/endian.h +++ b/sys/i386/include/endian.h @@ -58,26 +58,27 @@ #ifndef _KERNEL #include <sys/cdefs.h> #endif +#include <machine/ansi.h> __BEGIN_DECLS -unsigned long htonl(unsigned long); -unsigned short htons(unsigned short); -unsigned long ntohl(unsigned long); -unsigned short ntohs(unsigned short); +__uint32_t htonl(__uint32_t); +__uint16_t htons(__uint16_t); +__uint32_t ntohl(__uint32_t); +__uint16_t ntohs(__uint16_t); __END_DECLS #ifdef __GNUC__ -static __inline unsigned long -__uint16_swap_uint32(unsigned long __x) +static __inline __uint32_t +__uint16_swap_uint32(__uint32_t __x) { __asm ("rorl $16, %1" : "=r" (__x) : "0" (__x)); return __x; } -static __inline unsigned long -__uint8_swap_uint32(unsigned long __x) +static __inline __uint32_t +__uint8_swap_uint32(__uint32_t __x) { #if defined(_KERNEL) && (defined(I486_CPU) || defined(I586_CPU) || defined(I686_CPU)) && !defined(I386_CPU) __asm ("bswap %0" : "=r" (__x) : "0" (__x)); @@ -88,8 +89,8 @@ __uint8_swap_uint32(unsigned long __x) return __x; } -static __inline unsigned short -__uint8_swap_uint16(unsigned short __x) +static __inline __uint16_t +__uint8_swap_uint16(__uint16_t __x) { __asm ("xchgb %h1, %b1" : "=q" (__x) : "0" (__x)); |