Edit: I got this to work (see in answers below) in VS2012, but it still doesn't properly downcast in Xcode.
I am trying to downcast from an unsigned long to an int in C++, but data loss seems inevitable:
unsigned long bigInt= randomBigNumber;
int x = 2;
I then pass a big number to a function that accepts signed ints:
void myFunc(bigInt/(ULONG_MAX/x));
If randomBigNumber is a repeated random number -- such as in a for-loop -- I figure I should get a relatively evenly distributed number of ones and zeros, but I am only getting zeros.
How can I downcast this so as to get some ones?
Thanks.