Compare commits
4 Commits
6e212847ac
...
b8f6a8edf2
Author | SHA1 | Date | |
---|---|---|---|
b8f6a8edf2 | |||
01f1d5850f | |||
cd567383c3 | |||
53a442abf9 |
@@ -47,9 +47,7 @@ limitations under the License.
|
||||
#if __has_builtin(__builtin_assume)
|
||||
#define assume(e) __builtin_assume(e)
|
||||
#else
|
||||
#define assume(e) \
|
||||
if (!(e)) \
|
||||
__builtin_unreachable()
|
||||
#define assume(e) __attribute__((assume(e)))
|
||||
#endif
|
||||
#else
|
||||
#define assume assert
|
||||
@@ -145,20 +143,20 @@ private:
|
||||
};
|
||||
|
||||
bool BitSet::test(int i) const {
|
||||
assume(0 <= i);
|
||||
assume(i < 256);
|
||||
assert(0 <= i);
|
||||
assert(i < 256);
|
||||
return words[i >> 6] & (uint64_t(1) << (i & 63));
|
||||
}
|
||||
|
||||
void BitSet::set(int i) {
|
||||
assume(0 <= i);
|
||||
assume(i < 256);
|
||||
assert(0 <= i);
|
||||
assert(i < 256);
|
||||
words[i >> 6] |= uint64_t(1) << (i & 63);
|
||||
}
|
||||
|
||||
void BitSet::reset(int i) {
|
||||
assume(0 <= i);
|
||||
assume(i < 256);
|
||||
assert(0 <= i);
|
||||
assert(i < 256);
|
||||
words[i >> 6] &= ~(uint64_t(1) << (i & 63));
|
||||
}
|
||||
|
||||
@@ -273,9 +271,8 @@ static_assert(sizeof(Node256) < kMinChildrenNode256 * kBytesPerKey);
|
||||
static_assert(sizeof(Node48) < kMinChildrenNode48 * kBytesPerKey);
|
||||
static_assert(sizeof(Node16) < kMinChildrenNode16 * kBytesPerKey);
|
||||
static_assert(sizeof(Node4) < kMinChildrenNode4 * kBytesPerKey);
|
||||
static_assert(sizeof(Node0) < kBytesPerKey);
|
||||
|
||||
// Bounds memory usage in free list, but does not account for memory for partial
|
||||
// keys.
|
||||
template <class T, int64_t kMemoryBound = (1 << 20),
|
||||
int64_t kMaxIndividual = (1 << 10)>
|
||||
struct BoundedFreeListAllocator {
|
||||
@@ -958,7 +955,7 @@ struct SearchStepWise {
|
||||
SearchStepWise() {}
|
||||
SearchStepWise(Node *n, std::span<const uint8_t> remaining)
|
||||
: n(n), remaining(remaining) {
|
||||
assume(n->partialKeyLen == 0);
|
||||
assert(n->partialKeyLen == 0);
|
||||
}
|
||||
|
||||
bool step() {
|
||||
@@ -1582,7 +1579,7 @@ template <bool kBegin>
|
||||
auto *old = *self;
|
||||
int64_t oldMaxVersion = maxVersion(old, impl);
|
||||
|
||||
*self = allocators->node4.allocate(partialKeyIndex);
|
||||
*self = allocators->node0.allocate(partialKeyIndex);
|
||||
|
||||
memcpy((char *)*self + kNodeCopyBegin, (char *)old + kNodeCopyBegin,
|
||||
kNodeCopySize);
|
||||
|
Reference in New Issue
Block a user