From 64a4f6adf7c3f191cc819b5baa83dcb474aea2db Mon Sep 17 00:00:00 2001 From: Pavel Chupin Date: Fri, 19 Apr 2013 13:09:25 +0400 Subject: [PATCH] Update x86 machine/endian.h from upstream After download new version from upstream (OpenBSD 1.17) did the following: * changed all u_int* types to uint* * add #include All these changes are Android-specific and had been done before for previous version (1.14). Bug: http://code.google.com/p/android/issues/detail?id=54465 Change-Id: Ieb44e7fce4e794d997bb00ee0dd417fb61521720 Signed-off-by: Pavel Chupin --- libc/arch-x86/include/machine/endian.h | 28 +++++++++------------------- 1 file changed, 9 insertions(+), 19 deletions(-) diff --git a/libc/arch-x86/include/machine/endian.h b/libc/arch-x86/include/machine/endian.h index e7ad25784..e1506b110 100644 --- a/libc/arch-x86/include/machine/endian.h +++ b/libc/arch-x86/include/machine/endian.h @@ -1,4 +1,4 @@ -/* $OpenBSD: endian.h,v 1.14 2005/12/13 00:35:23 millert Exp $ */ +/* $OpenBSD: endian.h,v 1.17 2011/03/12 04:03:04 guenther Exp $ */ /*- * Copyright (c) 1997 Niklas Hallqvist. All rights reserved. @@ -24,38 +24,28 @@ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -#ifndef _I386_ENDIAN_H_ -#define _I386_ENDIAN_H_ +#ifndef _MACHINE_ENDIAN_H_ +#define _MACHINE_ENDIAN_H_ #ifdef __GNUC__ -#if defined(_KERNEL) && !defined(I386_CPU) -#define __swap32md(x) ({ \ +#define __swap32md(x) __statement({ \ uint32_t __swap32md_x = (x); \ \ - __asm ("bswap %1" : "+r" (__swap32md_x)); \ + __asm ("bswap %0" : "+r" (__swap32md_x)); \ __swap32md_x; \ }) -#else -#define __swap32md(x) ({ \ - uint32_t __swap32md_x = (x); \ - \ - __asm ("rorw $8, %w1; rorl $16, %1; rorw $8, %w1" : \ - "+r" (__swap32md_x)); \ - __swap32md_x; \ -}) -#endif /* _KERNEL && !I386_CPU */ -#define __swap64md(x) ({ \ +#define __swap64md(x) __statement({ \ uint64_t __swap64md_x = (x); \ \ (uint64_t)__swap32md(__swap64md_x >> 32) | \ (uint64_t)__swap32md(__swap64md_x & 0xffffffff) << 32; \ }) -#define __swap16md(x) ({ \ +#define __swap16md(x) __statement({ \ uint16_t __swap16md_x = (x); \ \ - __asm ("rorw $8, %w1" : "+r" (__swap16md_x)); \ + __asm ("rorw $8, %w0" : "+r" (__swap16md_x)); \ __swap16md_x; \ }) @@ -68,4 +58,4 @@ #include #include -#endif /* _I386_ENDIAN_H_ */ +#endif /* _MACHINE_ENDIAN_H_ */ -- 2.11.0