Commit 3ac402b1 authored by Philip Pronin's avatar Philip Pronin Committed by Sara Golemon

CHECK EliasFanoCompressedList::encode input is sorted

Test Plan: fbconfig -r folly/experimental/test && fbmake runtests_opt

Reviewed By: chaoyc@fb.com

FB internal diff: D1141124
parent 20697de2
/*
* Copyright 2013 Facebook, Inc.
* Copyright 2014 Facebook, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
......@@ -103,10 +103,13 @@ struct EliasFanoCompressedList {
encode(list, list + size, result);
}
// Range (begin, end) should be sorted.
template <class RandomAccessIterator>
static void encode(RandomAccessIterator begin,
RandomAccessIterator end,
EliasFanoCompressedList& result) {
CHECK(std::is_sorted(begin, end));
auto list = begin;
const size_t size = end - begin;
......@@ -115,8 +118,6 @@ struct EliasFanoCompressedList {
return;
}
DCHECK(std::is_sorted(list, list + size));
const ValueType upperBound = list[size - 1];
uint8_t numLowerBits = defaultNumLowerBits(upperBound, size);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment