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