Source-Changes-HG archive

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

[src/trunk]: src/sys/arch/pc532/include Convert the byte_swap_* macros from G...



details:   https://anonhg.NetBSD.org/src/rev/96e56fe78820
branches:  trunk
changeset: 518859:96e56fe78820
user:      simonb <simonb%NetBSD.org@localhost>
date:      Thu Dec 06 23:25:43 2001 +0000

description:
Convert the byte_swap_* macros from GNUish ({ ... }) extensions to
static inline functions.

diffstat:

 sys/arch/pc532/include/byte_swap.h |  27 ++++++++++++++-------------
 1 files changed, 14 insertions(+), 13 deletions(-)

diffs (43 lines):

diff -r 672acf07facf -r 96e56fe78820 sys/arch/pc532/include/byte_swap.h
--- a/sys/arch/pc532/include/byte_swap.h        Thu Dec 06 23:11:59 2001 +0000
+++ b/sys/arch/pc532/include/byte_swap.h        Thu Dec 06 23:25:43 2001 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: byte_swap.h,v 1.1 1999/01/15 13:31:26 bouyer Exp $     */
+/*     $NetBSD: byte_swap.h,v 1.2 2001/12/06 23:25:43 simonb Exp $     */
 
 /*
  * Copyright (c) 1987, 1991 Regents of the University of California.
@@ -38,20 +38,21 @@
 #ifndef _PC532_BYTE_SWAP_H_
 #define _PC532_BYTE_SWAP_H_
 
-#define __byte_swap_long_variable(x) __extension__ \
-({ register u_int32_t __x = (x); \
-   __asm ("rotw 8,%1; rotd 16,%1; rotw 8,%1" \
-       : "=r" (__x) \
-       : "0" (__x)); \
-   __x; })
+static __inline unsigned int
+__byte_swap_long_variable(unsigned int x)
+{
+
+       __asm ("rotw 8,%1; rotd 16,%1; rotw 8,%1" : "=r" (x) : "0" (x));
+       return (x);
+}
 
-#define __byte_swap_word_variable(x) __extension__ \
-({ register u_int16_t __x = (x); \
-   __asm ("rotw 8,%1" \
-       : "=r" (__x) \
-       : "0" (__x)); \
-   __x; })
+static __inline unsigned short
+__byte_swap_word_variable(unsigned short x)
+{
 
+       __asm ("rotw 8,%1" : "=r" (x) : "0" (x));
+       return (x);
+}
 
 #ifdef __OPTIMIZE__
 



Home | Main Index | Thread Index | Old Index