10 ms·
Nope, try low = 1, high = 1 and you get mid = 0.
by dataflow 4y ago
Nope, try low = 1, high = 1 and you get mid = 0.
- benmmurphy 4y agoi think you can fix it with: (low >> 1) + (high >> 1) + (low & 1 & high) for unsigned numbers. not sure if it works for signed numbers.