Received: from [140.186.70.92] (port=47113 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1PZ8Pg-0006ca-0q for qemu-devel@nongnu.org; Sat, 01 Jan 2011 15:50:56 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1PZ8Pe-0003fa-T0 for qemu-devel@nongnu.org; Sat, 01 Jan 2011 15:50:55 -0500 Received: from hall.aurel32.net ([88.191.126.93]:57517) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1PZ8Pe-0003e7-M5 for qemu-devel@nongnu.org; Sat, 01 Jan 2011 15:50:54 -0500 From: Aurelien Jarno Date: Sat, 1 Jan 2011 21:50:33 +0100 Message-Id: <1293915034-26391-1-git-send-email-aurelien@aurel32.net> Subject: [Qemu-devel] [PATCH 1/2] bswap.h: add cpu_to_be64wu() List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: Aurelien Jarno Signed-off-by: Aurelien Jarno --- bswap.h | 15 +++++++++++++++ 1 files changed, 15 insertions(+), 0 deletions(-) diff --git a/bswap.h b/bswap.h index 20caae6..82a7951 100644 --- a/bswap.h +++ b/bswap.h @@ -144,6 +144,7 @@ CPU_CONVERT(le, 64, uint64_t) #define cpu_to_be16wu(p, v) cpu_to_be16w(p, v) #define cpu_to_be32wu(p, v) cpu_to_be32w(p, v) +#define cpu_to_be64wu(p, v) cpu_to_be64w(p, v) #else @@ -201,6 +202,20 @@ static inline void cpu_to_be32wu(uint32_t *p, uint32_t v) p1[3] = v & 0xff; } +static inline void cpu_to_be64wu(uint64_t *p, uint64_t v) +{ + uint8_t *p1 = (uint8_t *)p; + + p1[0] = v >> 56; + p1[1] = v >> 48; + p1[2] = v >> 40; + p1[3] = v >> 32; + p1[4] = v >> 24; + p1[5] = v >> 16; + p1[6] = v >> 8; + p1[7] = v & 0xff; +} + #endif #ifdef HOST_WORDS_BIGENDIAN -- 1.7.2.3