AK: Fix overflow and mixed-signedness issues in binary_search() (#2961)

This commit is contained in:
Muhammad Zahalqa 2020-08-02 22:10:35 +03:00 committed by GitHub
commit 615ba0f368
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
Notes: sideshowbarker 2024-07-19 04:22:13 +09:00
4 changed files with 57 additions and 8 deletions

View file

@ -172,7 +172,7 @@ void RangeAllocator::deallocate(Range range)
ASSERT(!m_available_ranges.is_empty());
int nearby_index = 0;
size_t nearby_index = 0;
auto* existing_range = binary_search(
m_available_ranges.span(), range, [](auto& a, auto& b) {
return a.base().get() - b.end().get();