Simplify insert loop
This commit is contained in:
@@ -2798,20 +2798,10 @@ Node **insert(Node **self, std::span<const uint8_t> key,
|
||||
assert(maxVersion(*self, impl) <= writeVersion);
|
||||
setMaxVersion(*self, impl, writeVersion);
|
||||
|
||||
for (;; ++tls->accum.insert_iterations) {
|
||||
|
||||
if (key.size() == 0) {
|
||||
return self;
|
||||
}
|
||||
|
||||
bool existed = getChild(*self, key.front());
|
||||
auto &child = getOrCreateChild(*self, key, writeVersion, tls);
|
||||
if (!existed) {
|
||||
return &child;
|
||||
}
|
||||
|
||||
self = &child;
|
||||
for (; key.size() != 0; ++tls->accum.insert_iterations) {
|
||||
self = &getOrCreateChild(*self, key, writeVersion, tls);
|
||||
}
|
||||
return self;
|
||||
}
|
||||
|
||||
void destroyTree(Node *root) {
|
||||
|
Reference in New Issue
Block a user