mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-11-28 15:23:51 +00:00
Bug 998507 - add some assertions to BinarySearch (r=me)
This commit is contained in:
parent
5e19daf1f7
commit
8d264161c9
@ -42,6 +42,10 @@ BinarySearch(const Container &c, size_t begin, size_t end, T target, size_t *mat
|
||||
size_t middle = low + (high - low) / 2;
|
||||
const T &middleValue = c[middle];
|
||||
|
||||
MOZ_ASSERT(c[low] <= c[middle]);
|
||||
MOZ_ASSERT(c[middle] <= c[high - 1]);
|
||||
MOZ_ASSERT(c[low] <= c[high - 1]);
|
||||
|
||||
if (target == middleValue) {
|
||||
*matchOrInsertionPoint = middle;
|
||||
return true;
|
||||
|
Loading…
Reference in New Issue
Block a user