how to make a long long
Mihnea Balta
dark_lkml@mymail.ro
Thu Feb 20 09:05:00 GMT 2003
On Thursday 20 February 2003 10:56, Adrian Sandor wrote:
> Wich is the proper way to make an unsigned long long
> from two unsigned ints (high and low dwords) without
> too many conversions and calculations?
Choose whatever you like:
int main(){
union{
struct{
unsigned long long a:32;
unsigned long long b:32;
} gigi;
unsigned long long l;
} toto;
unsigned long long l;
unsigned long long referenceval;
toto.gigi.a = 0xFFFFFFFF;
toto.gigi.b = 0xFFFFFFFF;
l = 0xFFFFFFFF;
l <<= 32;
l += 0xFFFFFFFF;
memset(&referenceval, 0xFF, sizeof(referenceval));
printf("%llu\n%llu\n%llu\n", toto.l, l, referenceval);
return 0;
}
>
> thanks
>
> Adrian
>
> __________________________________________________
> Do you Yahoo!?
> Yahoo! Tax Center - forms, calculators, tips, more
> http://taxes.yahoo.com/
>
> ------------------------------------------------------------------------
> P.S. Stiai ca s-a lansat www.FreeSMS.ro ?
More information about the Gcc-help
mailing list