how to tell 64 vs 32 bit architecture ?

Andrew Milton akm at theinternet.com.au
Tue Sep 11 23:39:23 PDT 2007


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


More information about the freebsd-current mailing list