News for hackers. Stuff that matters.
Re:Binary Search Reconsidered (2018) by xxs on Friday December 25, 2020 @03:15PM (#25538716)
If the unsigned right shift is defined (java): "int mid = (min + max) >>> 1;"

edit: this is a bit longer version, if signed conversion/shift is not available: int mid = (min >> 1) + (max >> 1) + (min & max & 1)

There are no comments on this comment yet.