Source-Changes-HG archive

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

[src/trunk]: src/sys/arch/m68k/include convert from macros to static inlines....



details:   https://anonhg.NetBSD.org/src/rev/db7e06d8815e
branches:  trunk
changeset: 518755:db7e06d8815e
user:      lukem <lukem%NetBSD.org@localhost>
date:      Wed Dec 05 04:37:28 2001 +0000

description:
convert from macros to static inlines.  allen briggs confirms resultant code
is the same with -Ox, for x>0 (as expected).

diffstat:

 sys/arch/m68k/include/byte_swap.h |  29 +++++++++++++++++------------
 1 files changed, 17 insertions(+), 12 deletions(-)

diffs (43 lines):

diff -r b67d63d8b42d -r db7e06d8815e sys/arch/m68k/include/byte_swap.h
--- a/sys/arch/m68k/include/byte_swap.h Wed Dec 05 04:31:02 2001 +0000
+++ b/sys/arch/m68k/include/byte_swap.h Wed Dec 05 04:37:28 2001 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: byte_swap.h,v 1.3 2001/04/09 05:35:32 leo Exp $        */
+/*     $NetBSD: byte_swap.h,v 1.4 2001/12/05 04:37:28 lukem Exp $      */
 
 /*-
  * Copyright (c) 1998 The NetBSD Foundation, Inc.
@@ -39,17 +39,22 @@
 #ifndef        M68K_BYTE_SWAP_H_
 #define        M68K_BYTE_SWAP_H_
 
-#define __byte_swap_word(var)                          \
-        ({ u_int16_t    __var = (var);                 \
-               __asm__ __volatile ("rorw #8, %0"       \
-                                       : "=d" (__var)  \
-                                       : "0" (__var)); \
-            __var; })
+static __inline u_int16_t __byte_swap_word(u_int16_t);
+static __inline u_int32_t __byte_swap_long(u_int32_t);
 
-#define __byte_swap_long(var)    \
-        ({ u_int32_t    __var = (var);                                 \
-               __asm__ __volatile ("rorw #8, %0; swap %0; rorw #8, %0" \
-                                       : "=d" (__var) : "0" (__var));  \
-            __var; })
+static __inline u_int16_t
+__byte_swap_word(u_int16_t var)
+{
+       __asm__ __volatile ("rorw #8, %0" : "=d" (var) : "0" (var));
+       return (var);
+}
+
+static __inline u_int32_t
+__byte_swap_long(u_int32_t var)
+{
+       __asm__ __volatile (
+               "rorw #8, %0; swap %0; rorw #8, %0" : "=d" (var) : "0" (var));
+       return (var);
+}
 
 #endif /* !M68K_BYTE_SWAP_H_ */



Home | Main Index | Thread Index | Old Index