Re: how to tell 64 vs 32 bit architecture ?

From: Andrew Milton <akm_at_theinternet.com.au>
Date: Tue, 11 Sep 2007 22:48:57 +1000
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_at_theinternet.com.au
Received on Wed Sep 12 2007 - 04:39:23 UTC

This archive was generated by hypermail 2.4.0 : Wed May 19 2021 - 11:39:17 UTC