From: Carsten Hoeger (no email)
Date: Tue Sep 02 2003 - 04:30:05 EDT
On Mon, Sep 01, Wietse Venema wrote:
> On my I386 box the output from this test program is:
>
> 127
> 32767
> 2147483647
> 2147483647
> 9223372036854775807
>
> When changed to print hexadecimal output:
[...]
> Output becomes:
>
> 0x7f
> 0x7fff
> 0x7fffffff
> 0x7fffffff
> 0x7fffffffffffffff
>
> It would be nice to hear how this works on 64-bit systems. I can
> try this on SPARC/Solaris myself.
Linux x86 32bit:
127
32767
2147483647
2147483647
-4611701787399815169
0x7f
0x7fff
0x7fffffff
0x7fffffff
0xbffff1a87fffffff
Linux x86 32bit (using _FILE_OFFSET_BITS=64):
127
32767
2147483647
2147483647
9223372036854775807
0x7f
0x7fff
0x7fffffff
0x7fffffff
0x7fffffffffffffff
Linux x86_64(Opteron) 64bit:
127
32767
2147483647
9223372036854775807
9223372036854775807
0x7f
0x7fff
0x7fffffff
0x7fffffffffffffff
0x7fffffffffffffff
Linux s390x 64bit:
127
32767
2147483647
9223372036854775807
9223372036854775807
0x7f
0x7fff
0x7fffffff
0x7fffffffffffffff
0x7fffffffffffffff
Linux s390 32bit:
127
32767
2147483647
2147483647
9223372034711488064
0x7f
0x7fff
0x7fffffff
0x7fffffff
0x7fffffff80400686
Linux s390 32bit (using _FILE_OFFSET_BITS=64):
127
32767
2147483647
2147483647
9223372036854775807
0x7f
0x7fff
0x7fffffff
0x7fffffff
0x7fffffffffffffff
> Up to this point I think I understand how and why the macro works.
>
> However, if someone can explain to me why this produces 0xffffffff
> for long long on I386, then I am all ears. Every day brings an
> opportunity to learn something new about the C programming language.
You are telling me!
-- With best regards, Carsten Hoeger SuSE, The Linux Experts, http://suse.com - http://unitedlinux.com
|
|
|