This is the mail archive of the
gcc-help@gcc.gnu.org
mailing list for the GCC project.
Re: how to make a long long
- From: Adrian Sandor <aditsu at yahoo dot com>
- To: Mihnea Balta <dark_lkml at mymail dot ro>, gcc-help at gcc dot gnu dot org
- Date: Thu, 20 Feb 2003 01:57:53 -0800 (PST)
- Subject: Re: how to make a long long
--- Mihnea Balta <dark_lkml at mymail dot ro> wrote:
> union{
> struct{
> unsigned long long a:32;
> unsigned long long b:32;
> } gigi;
> unsigned long long l;
> } toto;
> toto.gigi.a = 0xFFFFFFFF;
> toto.gigi.b = 0xFFFFFFFF;
this might be the best way
but why use unsigned long bit fields and not just
unsigned ints? (or unsigned longs)
e.g. struct{unsigned int a,b;}gigi;
> unsigned long long l;
> l = 0xFFFFFFFF;
> l <<= 32;
> l += 0xFFFFFFFF;
this involves some calculations.. I doubt that the
compiler can optimize them
> unsigned long long referenceval;
> memset(&referenceval, 0xFF,
> sizeof(referenceval));
this works if the bytes are identical.. but usually
they are not
thanks for the reply
Adrian
__________________________________________________
Do you Yahoo!?
Yahoo! Tax Center - forms, calculators, tips, more
http://taxes.yahoo.com/