Patrick <[EMAIL PROTECTED]> writes:

> I wanna do a simple xor of two 64 bit variables as in the following
> code fragment:
>
>    unsigned long long test0 = 0x8888000000001210LL;
>    unsigned long long test1 = 0x88111111111100EFLL;
>    unsigned long long test2;
>
>    test2 = test0 | test1;

That does OR, not XOR. If you really wanted XOR, time to crack that
intro C book open again.

>    printf("0x%016x ",test2);
>
> Unfortuantely only the lower 32 bits of the result are correct as the
> output shows

That's because if you want to print a long (or long long) value,
you must use appropriate printf format. Time to turn on gcc warnings:

$ gcc -Wall junk.c
junk.c: In function 'main':
junk.c:11: warning: format '%016x' expects type 'unsigned int', but argument 2 
has type 'long long unsigned int'

> Anyone an idea why the higher 32 bits are not affected by the
> bitoperation?

They are affected, but due to a bug in your program they are not
printed correctly.

Cheers,
-- 
In order to understand recursion you must first understand recursion.
Remove /-nsp/ for email.
_______________________________________________
help-gplusplus mailing list
help-gplusplus@gnu.org
http://lists.gnu.org/mailman/listinfo/help-gplusplus

Reply via email to