From patchwork Sat Jan 1 20:50:33 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Aurelien Jarno X-Patchwork-Id: 77152 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [199.232.76.165]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id CB916B70D5 for ; Sun, 2 Jan 2011 07:52:51 +1100 (EST) Received: from localhost ([127.0.0.1]:52334 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1PZ8RT-0007Hu-He for incoming@patchwork.ozlabs.org; Sat, 01 Jan 2011 15:52:47 -0500 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 Received: from farad.aurel32.net ([82.232.2.251] helo=volta.aurel32.net) by hall.aurel32.net with esmtpsa (TLS1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.69) (envelope-from ) id 1PZ8PU-0006Wi-RA; Sat, 01 Jan 2011 21:50:44 +0100 Received: from aurel32 by volta.aurel32.net with local (Exim 4.72) (envelope-from ) id 1PZ8PS-0006xJ-T5; Sat, 01 Jan 2011 21:50:43 +0100 From: Aurelien Jarno To: qemu-devel@nongnu.org Date: Sat, 1 Jan 2011 21:50:33 +0100 Message-Id: <1293915034-26391-1-git-send-email-aurelien@aurel32.net> X-Mailer: git-send-email 1.7.2.3 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 3) Cc: Aurelien Jarno Subject: [Qemu-devel] [PATCH 1/2] bswap.h: add cpu_to_be64wu() X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org 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