I have an unsigned long long variable which is 8 bytes on my system which I'm trying to do the following on:
unsigned long long ull;
ull = timeLow;
ull |= timeHigh << 32;
I get a warning of: left shift count >= width of type when doing this. Also it doesn't seem to take into account the timeHigh shifted in. How do I fix this?
You're not shifting ull, you're shifiting timeHigh, and then storing the results of that shift in ull.
I suspect that timeHigh is not big enough to store the reults of a 32-bit shift. Make timeHigh an unsigned long long, (edit) or alternatively just assign timeHigh to ull and then shift that before or'ing in timeLow. (credit @JasonD)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With