This program is written in VC++ 6.0 on a WindowsXP machine.
If I try to set an __int64 variable to -2500000000 directly, it is truncated to a 32bit value and the two's complement is taken.
__int64 testval;
testval = -2500000000;
At this point testval equals 1794967293 (110 1010 1111 1101 0000 0111 0000 0000 binary).
When I set the variable to 2500000000 and then multiply by negative one, it works:
__int64 testval;
testval = 2500000000;
testval *= -1;
The variable testval equals -2500000000 (1001 0101 0000 0010 1111 1001 0000 0000 binary).
Any ideas? Thanks.
Get a newer compiler. VC6 standard compliance is VERY poor.
In VC6, try a suffix of
i64
, as inFound the documentation!