Minor style improvements
This commit is contained in:
@@ -960,8 +960,7 @@ private:
|
|||||||
NodeAllocator<Node256> node256;
|
NodeAllocator<Node256> node256;
|
||||||
};
|
};
|
||||||
|
|
||||||
int getNodeIndex(Node3 *self, uint8_t index) {
|
int getNodeIndex(Node3 *n, uint8_t index) {
|
||||||
Node3 *n = (Node3 *)self;
|
|
||||||
assume(n->numChildren >= 1);
|
assume(n->numChildren >= 1);
|
||||||
assume(n->numChildren <= 3);
|
assume(n->numChildren <= 3);
|
||||||
for (int i = 0; i < n->numChildren; ++i) {
|
for (int i = 0; i < n->numChildren; ++i) {
|
||||||
@@ -972,8 +971,7 @@ int getNodeIndex(Node3 *self, uint8_t index) {
|
|||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
int getNodeIndexExists(Node3 *self, uint8_t index) {
|
int getNodeIndexExists(Node3 *n, uint8_t index) {
|
||||||
Node3 *n = (Node3 *)self;
|
|
||||||
assume(n->numChildren >= 1);
|
assume(n->numChildren >= 1);
|
||||||
assume(n->numChildren <= 3);
|
assume(n->numChildren <= 3);
|
||||||
for (int i = 0; i < n->numChildren; ++i) {
|
for (int i = 0; i < n->numChildren; ++i) {
|
||||||
@@ -1274,33 +1272,32 @@ TaggedNodePointer getChild(Node *self, uint8_t index) {
|
|||||||
struct ChildAndMaxVersion {
|
struct ChildAndMaxVersion {
|
||||||
TaggedNodePointer child;
|
TaggedNodePointer child;
|
||||||
InternalVersionT maxVersion;
|
InternalVersionT maxVersion;
|
||||||
|
static ChildAndMaxVersion empty() {
|
||||||
|
ChildAndMaxVersion result;
|
||||||
|
result.child = nullptr;
|
||||||
|
return result;
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
ChildAndMaxVersion getChildAndMaxVersion(Node0 *, uint8_t) { return {}; }
|
ChildAndMaxVersion getChildAndMaxVersion(Node0 *, uint8_t) { return {}; }
|
||||||
ChildAndMaxVersion getChildAndMaxVersion(Node3 *self, uint8_t index) {
|
ChildAndMaxVersion getChildAndMaxVersion(Node3 *self, uint8_t index) {
|
||||||
int i = getNodeIndex(self, index);
|
int i = getNodeIndex(self, index);
|
||||||
if (i < 0) {
|
if (i < 0) {
|
||||||
ChildAndMaxVersion result;
|
return ChildAndMaxVersion::empty();
|
||||||
result.child = nullptr;
|
|
||||||
return result;
|
|
||||||
}
|
}
|
||||||
return {self->children[i], self->childMaxVersion[i]};
|
return {self->children[i], self->childMaxVersion[i]};
|
||||||
}
|
}
|
||||||
ChildAndMaxVersion getChildAndMaxVersion(Node16 *self, uint8_t index) {
|
ChildAndMaxVersion getChildAndMaxVersion(Node16 *self, uint8_t index) {
|
||||||
int i = getNodeIndex(self, index);
|
int i = getNodeIndex(self, index);
|
||||||
if (i < 0) {
|
if (i < 0) {
|
||||||
ChildAndMaxVersion result;
|
return ChildAndMaxVersion::empty();
|
||||||
result.child = nullptr;
|
|
||||||
return result;
|
|
||||||
}
|
}
|
||||||
return {self->children[i], self->childMaxVersion[i]};
|
return {self->children[i], self->childMaxVersion[i]};
|
||||||
}
|
}
|
||||||
ChildAndMaxVersion getChildAndMaxVersion(Node48 *self, uint8_t index) {
|
ChildAndMaxVersion getChildAndMaxVersion(Node48 *self, uint8_t index) {
|
||||||
int i = self->index[index];
|
int i = self->index[index];
|
||||||
if (i < 0) {
|
if (i < 0) {
|
||||||
ChildAndMaxVersion result;
|
return ChildAndMaxVersion::empty();
|
||||||
result.child = nullptr;
|
|
||||||
return result;
|
|
||||||
}
|
}
|
||||||
return {self->children[i], self->childMaxVersion[i]};
|
return {self->children[i], self->childMaxVersion[i]};
|
||||||
}
|
}
|
||||||
@@ -1383,17 +1380,11 @@ TaggedNodePointer getChildGeq(Node16 *self, int child) {
|
|||||||
|
|
||||||
TaggedNodePointer getChildGeq(Node48 *self, int child) {
|
TaggedNodePointer getChildGeq(Node48 *self, int child) {
|
||||||
int c = self->bitSet.firstSetGeq(child);
|
int c = self->bitSet.firstSetGeq(child);
|
||||||
if (c < 0) {
|
return c < 0 ? nullptr : self->children[self->index[c]];
|
||||||
return nullptr;
|
|
||||||
}
|
|
||||||
return self->children[self->index[c]];
|
|
||||||
}
|
}
|
||||||
TaggedNodePointer getChildGeq(Node256 *self, int child) {
|
TaggedNodePointer getChildGeq(Node256 *self, int child) {
|
||||||
int c = self->bitSet.firstSetGeq(child);
|
int c = self->bitSet.firstSetGeq(child);
|
||||||
if (c < 0) {
|
return c < 0 ? nullptr : self->children[c];
|
||||||
return nullptr;
|
|
||||||
}
|
|
||||||
return self->children[c];
|
|
||||||
}
|
}
|
||||||
|
|
||||||
TaggedNodePointer getChildGeq(Node *self, int child) {
|
TaggedNodePointer getChildGeq(Node *self, int child) {
|
||||||
|
Reference in New Issue
Block a user