Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

Nope, try low = 1, high = 1 and you get mid = 0.


i think you can fix it with: (low >> 1) + (high >> 1) + (low & 1 & high)

for unsigned numbers. not sure if it works for signed numbers.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: