diff options
author | 2001-06-27 04:12:45 +0000 | |
---|---|---|
committer | 2001-06-27 04:12:45 +0000 | |
commit | fd3a0a9dd92eddd40c4616a218ff60197cd155fb (patch) | |
tree | ce2a3f65bbeb3984e3107d99683883cdfc3e6cf3 | |
parent | Hold on to m0->m_pkthdr.len (just being pendantic) (diff) | |
download | wireguard-openbsd-fd3a0a9dd92eddd40c4616a218ff60197cd155fb.tar.xz wireguard-openbsd-fd3a0a9dd92eddd40c4616a218ff60197cd155fb.zip |
implement 64 bit swap and fix constraints on others
-rw-r--r-- | sys/arch/i386/include/endian.h | 15 |
1 files changed, 10 insertions, 5 deletions
diff --git a/sys/arch/i386/include/endian.h b/sys/arch/i386/include/endian.h index edffa1cb498..c3fab251dbe 100644 --- a/sys/arch/i386/include/endian.h +++ b/sys/arch/i386/include/endian.h @@ -1,4 +1,4 @@ -/* $OpenBSD: endian.h,v 1.11 1999/05/10 16:02:08 espie Exp $ */ +/* $OpenBSD: endian.h,v 1.12 2001/06/27 04:12:45 mickey Exp $ */ /*- * Copyright (c) 1997 Niklas Hallqvist. All rights reserved. @@ -38,7 +38,7 @@ #define __swap32md(x) ({ \ u_int32_t __swap32md_x = (x); \ \ - __asm ("bswap %1" : "=r" (__swap32md_x) : "0" (__swap32md_x)); \ + __asm ("bswap %1" : "+r" (__swap32md_x)); \ __swap32md_x; \ }) #else @@ -46,16 +46,21 @@ u_int32_t __swap32md_x = (x); \ \ __asm ("rorw $8, %w1; rorl $16, %1; rorw $8, %w1" : \ - "=r" (__swap32md_x) : "0" (__swap32md_x)); \ + "+r" (__swap32md_x)); \ __swap32md_x; \ }) #endif /* _KERNEL && !I386_CPU */ +#define __swap64md(x) ({ \ + u_int64_t __swap64md_x = (x); \ + \ + (u_int64_t)__swap32md(__swap64md_x >> 32) | \ + (u_int64_t)__swap32md(__swap64md_x & 0xffffffff) << 32; \ +}) #define __swap16md(x) ({ \ u_int16_t __swap16md_x = (x); \ \ - __asm ("rorw $8, %w1" : "=r" (__swap16md_x) : \ - "0" (__swap16md_x)); \ + __asm ("rorw $8, %w1" : "+r" (__swap16md_x)); \ __swap16md_x; \ }) |