mirror of
https://github.com/fergalmoran/ladybird.git
synced 2026-02-15 20:24:46 +00:00
binary_search takes a haystack, a size, a needle and a compare function. The compare function should return negative if a < b, positive if a > b and 0 if a == b. The "sane default" compare function is integral_compare which implements this with subtraction a - b. binary_search returns a pointer to a matching element, NOT necessarily the FIRST matching element. It returns a nullptr if the element was not found. This patch includes tests for binary_search.
2.4 KiB
2.4 KiB