PERFORCE change 132493 for review

Oleksandr Tymoshenko gonzo at FreeBSD.org
Fri Jan 4 08:37:40 PST 2008


http://perforce.freebsd.org/chv.cgi?CH=132493

Change 132493 by gonzo at gonzo_jeeves on 2008/01/04 16:37:32

	o Rempove NTOHL/NTOHS/etc... macroses, they came from NetBSD land
	o Add definition for __ntohl/__ntohs/etc... macroses for LE build
	o Some cosmetics

Affected files ...

.. //depot/projects/mips2-jnpr/src/sys/mips/include/endian.h#5 edit

Differences ...

==== //depot/projects/mips2-jnpr/src/sys/mips/include/endian.h#5 (text+ko) ====

@@ -111,33 +111,21 @@
 /*
  * Define the order of 32-bit words in 64-bit words.
  */
-#if _BYTE_ORDER == LITTLE_ENDIAN
-#define	_QUAD_HIGHWORD	1
-#define	_QUAD_LOWWORD	0
-#endif
- 
 #if _BYTE_ORDER == BIG_ENDIAN
 #define	_QUAD_HIGHWORD	0
 #define	_QUAD_LOWWORD	1
-#endif
-
-#if _BYTE_ORDER == BIG_ENDIAN
 #define	__htonl(x)	((__uint32_t)(x))
 #define	__htons(x)	((__uint16_t)(x))
 #define	__ntohl(x)	((__uint32_t)(x))
 #define	__ntohs(x)	((__uint16_t)(x))
-#endif
-
-
-/*
- * Macros for network/external number representation conversion.
- */
-
-#define	NTOHL(x)	(x) = __ntohl((x))
-#define	NTOHS(x)	(x) = __ntohs((x))
-#define	HTONQ(x)	(x) = __htonq((x))
-#define	HTONL(x)	(x) = __htonl((x))
-#define	HTONS(x)	(x) = __htons((x))
+#else
+#define	_QUAD_HIGHWORD	1
+#define	_QUAD_LOWWORD	0
+#define __ntohl(x)        (__bswap32(x))
+#define __ntohs(x)        (__bswap16(x))
+#define __htonl(x)        (__bswap32(x))
+#define __htons(x)        (__bswap16(x))
+#endif /* _BYTE_ORDER == BIG_ENDIAN */
 
 #endif /* !_POSIX_SOURCE */
 #endif /* !_MACHINE_ENDIAN_H_ */


More information about the p4-projects mailing list