Bitwise Binary Search: Elegant and Fast -- Orson Peters

peters-bitwisebinarysearch.png

I recently read the article Beautiful Branchless Binary Search by Malte Skarupke. In it they discuss the merits of the following snippet of C++ code implementing a binary search.

Bitwise Binary Search: Elegant and Fast

by Orson Peters

From the article:

In this article I will provide an alternative implementation based on similar ideas but with a very different interpretation that is (in my opinion) incredibly elegant and clear to understand, at least as far as binary searches go. The resulting implementation also saves a comparison in almost every case and ends up quite a bit smaller.

Add a Comment

Comments are closed.

Comments (0)

There are currently no comments on this entry.