MCPcopy Create free account
hub / github.com/OpenStarbound/OpenStarbound / leafShift

Method leafShift

source/test/btree_test.cpp:331–346  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

329 }
330
331 bool leafShift(Leaf& left, Leaf& right) {
332 if (left.count() + right.count() <= maxLeafSize) {
333 left.shiftLeft(right, right.count());
334 return true;
335 } else {
336 if (leafNeedsShift(right)) {
337 right.shiftRight(left, 1);
338 return true;
339 } else if (leafNeedsShift(left)) {
340 left.shiftLeft(right, 1);
341 return true;
342 } else {
343 return false;
344 }
345 }
346 }
347
348 Maybe<Leaf> leafSplit(Leaf& leaf) {
349 if (leaf.count() <= maxLeafSize) {

Callers

nothing calls this directly

Calls 3

countMethod · 0.45
shiftLeftMethod · 0.45
shiftRightMethod · 0.45

Tested by

no test coverage detected