makeCapacityAtLeast -> freeAndMakeCapacityAtLeast
This commit is contained in:
@@ -803,8 +803,9 @@ Node *nextLogical(Node *node) {
|
|||||||
// Invalidates `self`, replacing it with a node of at least capacity.
|
// Invalidates `self`, replacing it with a node of at least capacity.
|
||||||
// Does not return nodes to freelists when kUseFreeList is false.
|
// Does not return nodes to freelists when kUseFreeList is false.
|
||||||
template <bool kUseFreeList>
|
template <bool kUseFreeList>
|
||||||
void makeCapacityAtLeast(Node *&self, int capacity, NodeAllocators *allocators,
|
void freeAndMakeCapacityAtLeast(Node *&self, int capacity,
|
||||||
ConflictSet::Impl *impl) {
|
NodeAllocators *allocators,
|
||||||
|
ConflictSet::Impl *impl) {
|
||||||
switch (self->type) {
|
switch (self->type) {
|
||||||
case Type_Node0: {
|
case Type_Node0: {
|
||||||
auto *self0 = (Node0 *)self;
|
auto *self0 = (Node0 *)self;
|
||||||
@@ -915,8 +916,8 @@ void maybeDecreaseCapacity(Node *&self, NodeAllocators *allocators,
|
|||||||
if (self->partialKeyCapacity <= maxCapacity) {
|
if (self->partialKeyCapacity <= maxCapacity) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
makeCapacityAtLeast</*kUseFreeList*/ false>(self, maxCapacity, allocators,
|
freeAndMakeCapacityAtLeast</*kUseFreeList*/ false>(self, maxCapacity,
|
||||||
impl);
|
allocators, impl);
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO fuse into erase child so we don't need to repeat branches on type
|
// TODO fuse into erase child so we don't need to repeat branches on type
|
||||||
@@ -947,8 +948,8 @@ void maybeDownsize(Node *self, NodeAllocators *allocators,
|
|||||||
|
|
||||||
if (minCapacity > child->partialKeyCapacity) {
|
if (minCapacity > child->partialKeyCapacity) {
|
||||||
const bool update = child == dontInvalidate;
|
const bool update = child == dontInvalidate;
|
||||||
makeCapacityAtLeast</*kUseFreeList*/ true>(child, minCapacity,
|
freeAndMakeCapacityAtLeast</*kUseFreeList*/ true>(child, minCapacity,
|
||||||
allocators, impl);
|
allocators, impl);
|
||||||
if (update) {
|
if (update) {
|
||||||
dontInvalidate = child;
|
dontInvalidate = child;
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user