Source-Changes-HG archive

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

[src/trunk]: src/sys/arch/amd64/include Provide inline assembly version of bs...



details:   https://anonhg.NetBSD.org/src/rev/9bc7a5a00902
branches:  trunk
changeset: 750774:9bc7a5a00902
user:      joerg <joerg%NetBSD.org@localhost>
date:      Thu Jan 14 02:06:04 2010 +0000

description:
Provide inline assembly version of bswap64.

diffstat:

 sys/arch/amd64/include/byte_swap.h |  13 +++++++++++--
 1 files changed, 11 insertions(+), 2 deletions(-)

diffs (29 lines):

diff -r bd341b9798e0 -r 9bc7a5a00902 sys/arch/amd64/include/byte_swap.h
--- a/sys/arch/amd64/include/byte_swap.h        Wed Jan 13 23:24:29 2010 +0000
+++ b/sys/arch/amd64/include/byte_swap.h        Thu Jan 14 02:06:04 2010 +0000
@@ -1,7 +1,7 @@
-/*     $NetBSD: byte_swap.h,v 1.6 2008/10/26 00:08:15 mrg Exp $        */
+/*     $NetBSD: byte_swap.h,v 1.7 2010/01/14 02:06:04 joerg Exp $      */
 
 /*-
- * Copyright (c) 1998 The NetBSD Foundation, Inc.
+ * Copyright (c) 1998, 2010 The NetBSD Foundation, Inc.
  * All rights reserved.
  *
  * This code is derived from software contributed to The NetBSD Foundation
@@ -42,6 +42,15 @@
 #include <sys/types.h>
 __BEGIN_DECLS
 
+#define        __BYTE_SWAP_U64_VARIABLE __byte_swap_u64_variable
+static __inline uint64_t __byte_swap_u64_variable(uint64_t);
+static __inline uint64_t
+__byte_swap_u64_variable(uint64_t x)
+{
+       __asm volatile ( "bswap %1" : "=r" (x) : "0" (x));
+       return (x);
+}
+
 #define        __BYTE_SWAP_U32_VARIABLE __byte_swap_u32_variable
 static __inline uint32_t __byte_swap_u32_variable(uint32_t);
 static __inline uint32_t



Home | Main Index | Thread Index | Old Index