I have 2 32-bit integers (‘r’ and ‘r2) that I want to convert to an unsigned 64-bit integer. (I don’t care about changing a negative to positive number going from int to uint, I’m creating a new random number so it should be irrelevant).
I thought the code below would do the job:
quint64 ruint64 = static_cast<quint32>(r);
ruint64<<32; // Shift the bits left 32 positions
ruint64 != r2; // Overlay second random number
But the compiler warns me that the second statement has no effect. Why? (quint32 is a 32-bit unsigned int).
The compiler also warns about comparing integers of different signedness on line 3. Why? I’m not comparing, just trying to move the r2 int into the rightmost 32 bits of runint64.