Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/netbsd-1-6]: src/sys/arch/arm/include Pull up revision 1.4 (requested by...



details:   https://anonhg.NetBSD.org/src/rev/4aff63d93717
branches:  netbsd-1-6
changeset: 529385:4aff63d93717
user:      he <he%NetBSD.org@localhost>
date:      Mon Nov 18 01:03:52 2002 +0000

description:
Pull up revision 1.4 (requested by thoeprj in ticket #667):
  Byte-swapping optimizations, enabled if compiling with GCC:
   o Byte-swap 16-bit and 32-bit constants at compile-time
   o Inline 16-bit and 32-bit variable byte-swaps

diffstat:

 sys/arch/arm/include/endian_machdep.h |  15 ++++++++++++++-
 1 files changed, 14 insertions(+), 1 deletions(-)

diffs (26 lines):

diff -r a99323574529 -r 4aff63d93717 sys/arch/arm/include/endian_machdep.h
--- a/sys/arch/arm/include/endian_machdep.h     Mon Nov 18 01:03:30 2002 +0000
+++ b/sys/arch/arm/include/endian_machdep.h     Mon Nov 18 01:03:52 2002 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: endian_machdep.h,v 1.3 2001/02/17 14:55:44 bjh21 Exp $ */
+/* $NetBSD: endian_machdep.h,v 1.3.20.1 2002/11/18 01:03:52 he Exp $ */
 
 /* GCC predefines __ARMEB__ when building for big-endian ARM. */
 #ifdef __ARMEB__
@@ -6,3 +6,16 @@
 #else
 #define _BYTE_ORDER _LITTLE_ENDIAN
 #endif
+
+#ifdef __GNUC__
+
+#include <arm/byte_swap.h>
+
+#if _BYTE_ORDER == _LITTLE_ENDIAN
+#define        ntohl(x)        ((in_addr_t)__byte_swap_long((in_addr_t)(x)))
+#define        ntohs(x)        ((in_port_t)__byte_swap_word((in_port_t)(x)))
+#define        htonl(x)        ((in_addr_t)__byte_swap_long((in_addr_t)(x)))
+#define        htons(x)        ((in_port_t)__byte_swap_word((in_port_t)(x)))
+#endif
+
+#endif



Home | Main Index | Thread Index | Old Index