Source-Changes-HG archive

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

[src/trunk]: src/sys/arch/x86_64/include replace __byte_swap_long_variable an...



details:   https://anonhg.NetBSD.org/src/rev/e24b21783406
branches:  trunk
changeset: 516931:e24b21783406
user:      lukem <lukem%NetBSD.org@localhost>
date:      Fri Nov 02 05:23:48 2001 +0000

description:
replace __byte_swap_long_variable and __byte_swap_word_variable
#define ({ })  with  static __inline { }

diffstat:

 sys/arch/x86_64/include/byte_swap.h |  31 ++++++++++++++++++-------------
 1 files changed, 18 insertions(+), 13 deletions(-)

diffs (46 lines):

diff -r c9cfc7e4ee90 -r e24b21783406 sys/arch/x86_64/include/byte_swap.h
--- a/sys/arch/x86_64/include/byte_swap.h       Fri Nov 02 05:21:47 2001 +0000
+++ b/sys/arch/x86_64/include/byte_swap.h       Fri Nov 02 05:23:48 2001 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: byte_swap.h,v 1.1 2001/06/19 00:20:10 fvdl Exp $       */
+/*     $NetBSD: byte_swap.h,v 1.2 2001/11/02 05:23:48 lukem Exp $      */
 
 /*-
  * Copyright (c) 1998 The NetBSD Foundation, Inc.
@@ -43,19 +43,24 @@
 #ifndef _X86_64_BYTE_SWAP_H_
 #define        _X86_64_BYTE_SWAP_H_
 
-#define        __byte_swap_long_variable(x) __extension__ \
-({ register in_addr_t __x = (x); \
-   __asm ("bswap %1" \
-       : "=r" (__x) \
-       : "0" (__x)); \
-   __x; })
+
+static __inline u_int32_t __byte_swap_long_variable(u_int32_t);
+static __inline u_int16_t __byte_swap_word_variable(u_int16_t);
 
-#define        __byte_swap_word_variable(x) __extension__ \
-({ register in_port_t __x = (x); \
-   __asm ("rorw $8, %w1" \
-       : "=r" (__x) \
-       : "0" (__x)); \
-   __x; })
+static __inline u_int32_t
+__byte_swap_long_variable(u_int32_t x)
+{
+       __asm __volatile ( "bswap %1" : "=r" (x) : "0" (x));
+       return x;
+}
+
+static __inline u_int16_t
+__byte_swap_word_variable(u_int16_t x)
+{
+       __asm __volatile ("rorw $8, %w1" : "=r" (x) : "0" (x)); 
+       return x;
+}
+
 
 #ifdef __OPTIMIZE__
 



Home | Main Index | Thread Index | Old Index