News for hackers. Stuff that matters.
Re:Binary Search Reconsidered (2018) by klyrs on Friday December 25, 2020 @04:57PM (#25539355)
As I've pointed out in another comment, this implementation loses track of the index. It looks clean enough to my un-rusty eye, but it sacrifices functionality in favor of hiding the arithmetic behind a slice.

And __s's comment does it best: use the standard library. And that's a nice implementation (despite the unsafe stuff), which tracks the basepoint and size to keep the arithmetic clean.

There are no comments on this comment yet.