Bug 998507 - add some assertions to BinarySearch (r=me)

This commit is contained in:
Luke Wagner 2014-04-22 13:53:37 -05:00
parent 5e19daf1f7
commit 8d264161c9

View File

@ -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;