From patchwork Fri Dec 18 11:16:03 2009 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Gerd Hoffmann X-Patchwork-Id: 41394 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 395CCB6F07 for ; Fri, 18 Dec 2009 22:46:43 +1100 (EST) Received: from localhost ([127.0.0.1]:59079 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1NLbI7-0001nX-Nm for incoming@patchwork.ozlabs.org; Fri, 18 Dec 2009 06:46:39 -0500 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1NLaoj-0005jn-UW for qemu-devel@nongnu.org; Fri, 18 Dec 2009 06:16:18 -0500 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1NLaoe-0005d6-7C for qemu-devel@nongnu.org; Fri, 18 Dec 2009 06:16:17 -0500 Received: from [199.232.76.173] (port=51219 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1NLaod-0005cR-6o for qemu-devel@nongnu.org; Fri, 18 Dec 2009 06:16:11 -0500 Received: from mx1.redhat.com ([209.132.183.28]:63875) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1NLaoc-0005PM-My for qemu-devel@nongnu.org; Fri, 18 Dec 2009 06:16:11 -0500 Received: from int-mx01.intmail.prod.int.phx2.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) by mx1.redhat.com (8.13.8/8.13.8) with ESMTP id nBIBG9pO030666 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Fri, 18 Dec 2009 06:16:09 -0500 Received: from zweiblum.home.kraxel.org (vpn1-6-184.ams2.redhat.com [10.36.6.184]) by int-mx01.intmail.prod.int.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id nBIBG7jb020889; Fri, 18 Dec 2009 06:16:08 -0500 Received: by zweiblum.home.kraxel.org (Postfix, from userid 500) id A2C7470FCD; Fri, 18 Dec 2009 12:16:04 +0100 (CET) From: Gerd Hoffmann To: qemu-devel@nongnu.org, seabios@seabios.org Date: Fri, 18 Dec 2009 12:16:03 +0100 Message-Id: <1261134964-12427-4-git-send-email-kraxel@redhat.com> In-Reply-To: <1261134964-12427-1-git-send-email-kraxel@redhat.com> References: <1261134964-12427-1-git-send-email-kraxel@redhat.com> X-Scanned-By: MIMEDefang 2.67 on 10.5.11.11 X-detected-operating-system: by monty-python.gnu.org: Genre and OS details not recognized. Cc: Gerd Hoffmann Subject: [Qemu-devel] [PATCH 3/4] move htonl() + friends to util.h 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 As the next patch will add one more user of the macros move them to util.h. Also add the 16bit variants. Signed-off-by: Gerd Hoffmann --- src/coreboot.c | 5 ----- src/util.h | 7 +++++++ 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/src/coreboot.c b/src/coreboot.c index 7fa18e4..3dc6a7f 100644 --- a/src/coreboot.c +++ b/src/coreboot.c @@ -351,11 +351,6 @@ ulzma(u8 *dst, u32 maxlen, const u8 *src, u32 srclen) * Coreboot flash format ****************************************************************/ -// XXX - optimize -#define ntohl(x) ((((x)&0xff)<<24) | (((x)&0xff00)<<8) | \ - (((x)&0xff0000) >> 8) | (((x)&0xff000000) >> 24)) -#define htonl(x) ntohl(x) - #define CBFS_HEADER_MAGIC 0x4F524243 #define CBFS_HEADPTR_ADDR 0xFFFFFFFc #define CBFS_VERSION1 0x31313131 diff --git a/src/util.h b/src/util.h index 1eafce0..24e39d1 100644 --- a/src/util.h +++ b/src/util.h @@ -367,4 +367,11 @@ extern u8 BiosChecksum; // version (auto generated file out/version.c) extern const char VERSION[]; +// XXX - optimize +#define ntohl(x) ((((x)&0xff)<<24) | (((x)&0xff00)<<8) | \ + (((x)&0xff0000) >> 8) | (((x)&0xff000000) >> 24)) +#define htonl(x) ntohl(x) +#define ntohs(x) ((((x)&0xff)<<8) | (((x)&0xff00)>>8)) +#define htons(x) ntohs(x) + #endif // util.h