From owner-freebsd-current@FreeBSD.ORG Wed Sep 12 06:39:23 2007 Return-Path: Delivered-To: current@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 00FE416A41A for ; Wed, 12 Sep 2007 06:39:23 +0000 (UTC) (envelope-from akm@theinternet.com.au) Received: from fallbackmx02.syd.optusnet.com.au (fallbackmx02.syd.optusnet.com.au [211.29.133.72]) by mx1.freebsd.org (Postfix) with ESMTP id 3724B13C458 for ; Wed, 12 Sep 2007 06:39:21 +0000 (UTC) (envelope-from akm@theinternet.com.au) Received: from mail02.syd.optusnet.com.au (mail02.syd.optusnet.com.au [211.29.132.183]) by fallbackmx02.syd.optusnet.com.au (8.12.11.20060308/8.12.11) with ESMTP id l8BCnAW9020969 for ; Tue, 11 Sep 2007 22:49:14 +1000 Received: from camelot.theinternet.com.au (c211-30-133-243.carlnfd4.nsw.optusnet.com.au [211.30.133.243]) by mail02.syd.optusnet.com.au (8.13.1/8.13.1) with ESMTP id l8BCmvrj016895; Tue, 11 Sep 2007 22:49:08 +1000 Received: by camelot.theinternet.com.au (Postfix, from userid 1000) id 302496113; Tue, 11 Sep 2007 22:48:57 +1000 (EST) Date: Tue, 11 Sep 2007 22:48:57 +1000 From: Andrew Milton To: Luigi Rizzo Message-ID: <20070911124857.GW4840@camelot.theinternet.com.au> References: <20070906111028.A83649@xorpc.icir.org> <20070906222647.GB2737@kobe.laptop> <20070907000950.A91211@xorpc.icir.org> <20070907115021.GA2718@kobe.laptop> <20070907050310.A94579@xorpc.icir.org> <54b90fdf0709070654h103316f3sa3d423f4ff75fee3@mail.gmail.com> <20070911051653.A62022@xorpc.icir.org> <20070911123556.GF53667@deviant.kiev.zoral.com.ua> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20070911123556.GF53667@deviant.kiev.zoral.com.ua> User-Agent: Mutt/1.5.15 (2007-04-06) Cc: current@freebsd.org Subject: Re: how to tell 64 vs 32 bit architecture ? X-BeenThere: freebsd-current@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Discussions about the use of FreeBSD-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 12 Sep 2007 06:39:23 -0000 On Tue, Sep 11, 2007 at 05:16:53AM -0700, Luigi Rizzo wrote: > > gcc 3.4 on a 32bit machine complains because the second constant > is too large. Can I ask why the 64 bit constant isn't 0xd00de123deadbeef , which would make bits 0-31 the same for both architectures, which might simplify the problem. #define MY_MAGIC 0xd00de123deadbeefLL int main(int argc, char **argv) { printf("0x%08x\n", MY_MAGIC); } outputs 0xdeadbeef on 32 bit architectures, so it IS truncating the top 32 bits. I know this doesn't solve the broader problem of detecting word length, but, it might solve your immediate problem. -- Andrew Milton akm@theinternet.com.au