Use AssertInfo instead of assert to ensure compiling (#16533)

Signed-off-by: zhenshan.cao <zhenshan.cao@zilliz.com>
pull/16620/head
zhenshan.cao 2022-04-25 10:27:46 +08:00 committed by GitHub
parent 89b4a34892
commit 65a9e01a8f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 4 additions and 3 deletions

View File

@ -18,7 +18,7 @@
#include <deque>
#include <boost_ext/dynamic_bitset_ext.hpp>
#include "exceptions/EasyAssert.h"
#include "common/Types.h"
#include "knowhere/utils/BitsetView.h"
@ -50,8 +50,9 @@ class BitsetView : public faiss::BitsetView {
if (empty()) {
return BitsetView();
}
assert((offset & 0x7) == 0);
assert((offset + size) <= this->size());
AssertInfo((offset & 0x7) == 0, "offset is not divisible by 8");
AssertInfo((offset + size) <= this->size(), "offset + size cross the border.");
return BitsetView(data() + (offset >> 3), size);
}
};