3 ms·
In C and C++ (where you don't have the >>> operator), you can do this: 6: mid = ((unsigned int)low + (unsigned int)high)) >> 1; Since you're c
by Sean1708 8y ago
In C and C++ (where you don't have the >>> operator), you can do this:
6: mid = ((unsigned int)low + (unsigned int)high)) >> 1;
Since you're casting to unsigned int anyway, can't you just use / 2?
- kevinventullo 8y agoYeah, I believe those compile to the same thing for unsigned ints. You can confirm using godbolt.