OSEC

Neohapsis is currently accepting applications for employment. For more information, please visit our website www.neohapsis.com or email hr@neohapsis.com
 
Re: max file size (again)...

From: Carsten Hoeger (choegersuse.de)
Date: Tue Sep 02 2003 - 03:30:05 CDT


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

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.2 (GNU/Linux)

iD8DBQE/VFUNeYi2qGaRyUoRArmlAJ9wNY82aQqUn9ThFTiAqtwqrH1nDQCfUclk
S+huK+HCqADIIoLXRBstbek=
=kUXt
-----END PGP SIGNATURE-----