Commit fca2bd43 authored by Philipp Götze's avatar Philipp Götze
Browse files

Added custom Bitmap for individual handling of underlying words

parent fb6ffc73
...@@ -86,7 +86,7 @@ static void BM_TreeErase(benchmark::State &state) { ...@@ -86,7 +86,7 @@ static void BM_TreeErase(benchmark::State &state) {
pop.drain(); pop.drain();
const auto pos = treeRef.lookupPositionInLeafNode(leaf, KEYPOS); const auto pos = treeRef.lookupPositionInLeafNode(leaf, KEYPOS);
// const auto pos = dbis::BitOperations::getFreeZero(leaf->bits.get_ro()); // const auto pos = leaf->bits.get_ro().getFreeZero();
#ifdef ENABLE_PCM #ifdef ENABLE_PCM
SocketCounterState before_sstate; SocketCounterState before_sstate;
......
...@@ -93,7 +93,7 @@ static void BM_TreeInsert(benchmark::State &state) { ...@@ -93,7 +93,7 @@ static void BM_TreeInsert(benchmark::State &state) {
const auto reqTup = MyTuple(KEYPOS, KEYPOS * 100, KEYPOS * 1.0); const auto reqTup = MyTuple(KEYPOS, KEYPOS * 100, KEYPOS * 1.0);
const auto pos = treeRef.lookupPositionInLeafNode(leaf, KEYPOS); const auto pos = treeRef.lookupPositionInLeafNode(leaf, KEYPOS);
//const auto pos = dbis::BitOperations::getFreeZero(leaf->bits.get_ro()); // const auto pos = leaf->bits.get_ro().getFreeZero();
#ifdef ENABLE_PCM #ifdef ENABLE_PCM
SocketCounterState before_sstate; SocketCounterState before_sstate;
......
This diff is collapsed.
...@@ -18,10 +18,10 @@ ...@@ -18,10 +18,10 @@
#ifndef DBIS_BitPBPTree_hpp_ #ifndef DBIS_BitPBPTree_hpp_
#define DBIS_BitPBPTree_hpp_ #define DBIS_BitPBPTree_hpp_
#include <libpmemobj/ctl.h>
#include <array> #include <array>
#include <iostream> #include <iostream>
#include <libpmemobj/ctl.h>
#include <libpmemobj++/make_persistent.hpp> #include <libpmemobj++/make_persistent.hpp>
#include <libpmemobj++/p.hpp> #include <libpmemobj++/p.hpp>
#include <libpmemobj++/persistent_ptr.hpp> #include <libpmemobj++/persistent_ptr.hpp>
...@@ -29,7 +29,7 @@ ...@@ -29,7 +29,7 @@
#include <libpmemobj++/utils.hpp> #include <libpmemobj++/utils.hpp>
#include "config.h" #include "config.h"
#include "utils/BitOperations.hpp" #include "utils/Bitmap.hpp"
#include "utils/PersistEmulation.hpp" #include "utils/PersistEmulation.hpp"
#include "utils/SearchFunctions.hpp" #include "utils/SearchFunctions.hpp"
...@@ -41,18 +41,18 @@ using pmem::obj::make_persistent; ...@@ -41,18 +41,18 @@ using pmem::obj::make_persistent;
using pmem::obj::p; using pmem::obj::p;
using pmem::obj::persistent_ptr; using pmem::obj::persistent_ptr;
using pmem::obj::transaction; using pmem::obj::transaction;
template<typename Object> template <typename Object>
using pptr = persistent_ptr<Object>; using pptr = persistent_ptr<Object>;
/** /**
* A persistent memory implementation of a B+ tree. * A persistent memory implementation of a B+ tree.
* *
* @tparam KeyType the data type of the key * @tparam KeyType the data type of the key
* @tparam ValueType the data type of the values associated with the key * @tparam ValueType the data type of the values associated with the key
* @tparam N the maximum number of keys on a branch node * @tparam N the maximum number of keys on a branch node
* @tparam M the maximum number of keys on a leaf node * @tparam M the maximum number of keys on a leaf node
*/ */
template<typename KeyType, typename ValueType, size_t N, size_t M> template <typename KeyType, typename ValueType, size_t N, size_t M>
class BitPBPTree { class BitPBPTree {
/// we need at least two keys on a branch node to be able to split /// we need at least two keys on a branch node to be able to split
static_assert(N > 2, "number of branch keys has to be >2."); static_assert(N > 2, "number of branch keys has to be >2.");
...@@ -62,9 +62,9 @@ class BitPBPTree { ...@@ -62,9 +62,9 @@ class BitPBPTree {
static_assert(M > 0, "number of leaf keys should be >0."); static_assert(M > 0, "number of leaf keys should be >0.");
#ifndef UNIT_TESTS #ifndef UNIT_TESTS
private: private:
#else #else
public: public:
#endif #endif
/// Forward declarations /// Forward declarations
...@@ -72,36 +72,43 @@ class BitPBPTree { ...@@ -72,36 +72,43 @@ class BitPBPTree {
struct BranchNode; struct BranchNode;
struct Node { struct Node {
Node() : tag(BLANK) {}; Node() : tag(BLANK){};
explicit Node(const pptr<LeafNode> &leaf_) : tag(LEAF), leaf(leaf_) {}; explicit Node(const pptr<LeafNode> &leaf_) : tag(LEAF), leaf(leaf_){};
explicit Node(const pptr<BranchNode> &branch_) : tag(BRANCH), branch(branch_) {}; explicit Node(const pptr<BranchNode> &branch_) : tag(BRANCH), branch(branch_){};
Node(const Node &other) { copy(other); }; Node(const Node &other) { copy(other); };
void copy(const Node &other) { void copy(const Node &other) {
tag = other.tag; tag = other.tag;
switch (tag) { switch (tag) {
case LEAF: { case LEAF: {
leaf = other.leaf; break; leaf = other.leaf;
break;
} }
case BRANCH: { case BRANCH: {
branch = other.branch; break; branch = other.branch;
break;
} }
default:; default:;
} }
} }
Node &operator=(const Node &other) { copy(other); return *this; } Node &operator=(const Node &other) {
copy(other);
return *this;
}
Node &operator=(const pptr<LeafNode> &leaf_) { Node &operator=(const pptr<LeafNode> &leaf_) {
tag = LEAF; leaf = leaf_; return *this; tag = LEAF;
leaf = leaf_;
return *this;
} }
Node &operator=(const pptr<BranchNode> &branch_) { Node &operator=(const pptr<BranchNode> &branch_) {
tag = BRANCH; branch = branch_; return *this; tag = BRANCH;
branch = branch_;
return *this;
} }
enum NodeType { enum NodeType { BLANK, LEAF, BRANCH } tag;
BLANK, LEAF, BRANCH
} tag;
union { union {
pptr<LeafNode> leaf; pptr<LeafNode> leaf;
...@@ -115,7 +122,6 @@ class BitPBPTree { ...@@ -115,7 +122,6 @@ class BitPBPTree {
* A structure for representing a leaf node of a B+ tree. * A structure for representing a leaf node of a B+ tree.
*/ */
struct alignas(64) LeafNode { struct alignas(64) LeafNode {
static constexpr auto NUM_KEYS = M; static constexpr auto NUM_KEYS = M;
using KEY_TYPE = KeyType; using KEY_TYPE = KeyType;
...@@ -127,7 +133,7 @@ class BitPBPTree { ...@@ -127,7 +133,7 @@ class BitPBPTree {
static constexpr auto BitsetSize = ((M + 63) / 64) * 8; ///< number * size of words static constexpr auto BitsetSize = ((M + 63) / 64) * 8; ///< number * size of words
static constexpr auto PaddingSize = (64 - (BitsetSize + 32) % 64) % 64; static constexpr auto PaddingSize = (64 - (BitsetSize + 32) % 64) % 64;
p<std::bitset<M>> bits; ///< bitset for valid entries p<dbis::Bitmap<M>> bits; ///< bitmap for valid entries
pptr<LeafNode> nextLeaf; ///< pointer to the subsequent sibling pptr<LeafNode> nextLeaf; ///< pointer to the subsequent sibling
pptr<LeafNode> prevLeaf; ///< pointer to the preceeding sibling pptr<LeafNode> prevLeaf; ///< pointer to the preceeding sibling
char padding[PaddingSize]; ///< padding to align keys to 64 bytes char padding[PaddingSize]; ///< padding to align keys to 64 bytes
...@@ -140,18 +146,17 @@ class BitPBPTree { ...@@ -140,18 +146,17 @@ class BitPBPTree {
* The rightmost child is always at position N. * The rightmost child is always at position N.
*/ */
struct alignas(64) BranchNode { struct alignas(64) BranchNode {
static constexpr auto NUM_KEYS = N; static constexpr auto NUM_KEYS = N;
using KEY_TYPE = KeyType; using KEY_TYPE = KeyType;
/** /**
* Constructor for creating a new empty branch node. * Constructor for creating a new empty branch node.
*/ */
BranchNode(){} BranchNode() {}
p<std::bitset<N>> bits; ///< bitset for valid entries p<dbis::Bitmap<N>> bits; ///< bitmap for valid entries
p<std::array<KeyType, N>> keys; ///< the actual keys p<std::array<KeyType, N>> keys; ///< the actual keys
p<std::array<Node, N + 1>> children; ///< pointers to child nodes (BranchNode or LeafNode) p<std::array<Node, N + 1>> children; ///< pointers to child nodes (BranchNode or LeafNode)
}; };
/* -------------------------------------------------------------------------------------------- */ /* -------------------------------------------------------------------------------------------- */
...@@ -160,9 +165,9 @@ class BitPBPTree { ...@@ -160,9 +165,9 @@ class BitPBPTree {
* A structure for passing information about a node split to the caller. * A structure for passing information about a node split to the caller.
*/ */
struct SplitInfo { struct SplitInfo {
KeyType key; ///< the key at which the node was split KeyType key; ///< the key at which the node was split
Node leftChild; ///< the resulting lhs child node Node leftChild; ///< the resulting lhs child node
Node rightChild; ///< the resulting rhs child node Node rightChild; ///< the resulting rhs child node
}; };
static constexpr pobj_alloc_class_desc AllocClass{256, 64, 1, POBJ_HEADER_COMPACT}; static constexpr pobj_alloc_class_desc AllocClass{256, 64, 1, POBJ_HEADER_COMPACT};
...@@ -173,7 +178,6 @@ class BitPBPTree { ...@@ -173,7 +178,6 @@ class BitPBPTree {
This pointer is never @c nullptr. */ This pointer is never @c nullptr. */
public: public:
/** /**
* Iterator for iterating over the leaf nodes. * Iterator for iterating over the leaf nodes.
*/ */
...@@ -181,7 +185,7 @@ class BitPBPTree { ...@@ -181,7 +185,7 @@ class BitPBPTree {
pptr<LeafNode> currentNode; pptr<LeafNode> currentNode;
size_t currentPosition; size_t currentPosition;
public: public:
iterator() : currentNode(nullptr), currentPosition(0) {} iterator() : currentNode(nullptr), currentPosition(0) {}
iterator(const Node &root, size_t d) { iterator(const Node &root, size_t d) {
...@@ -193,16 +197,16 @@ class BitPBPTree { ...@@ -193,16 +197,16 @@ class BitPBPTree {
currentNode = node.leaf; currentNode = node.leaf;
currentPosition = 0; currentPosition = 0;
const auto &nodeBits = currentNode->bits.get_ro(); const auto &nodeBits = currentNode->bits.get_ro();
while(!nodeBits.test(currentPosition)) ++currentPosition; while (!nodeBits.test(currentPosition)) ++currentPosition;
} }
iterator &operator++() { iterator &operator++() {
if (currentPosition >= M-1) { if (currentPosition >= M - 1) {
currentNode = currentNode->nextLeaf; currentNode = currentNode->nextLeaf;
currentPosition = 0; currentPosition = 0;
if (currentNode == nullptr) return *this; if (currentNode == nullptr) return *this;
const auto &nodeBits = currentNode->bits.get_ro(); const auto &nodeBits = currentNode->bits.get_ro();
while(!nodeBits.test(currentPosition)) { while (!nodeBits.test(currentPosition)) {
++currentPosition; ++currentPosition;
}; };
} else { } else {
...@@ -241,7 +245,6 @@ class BitPBPTree { ...@@ -241,7 +245,6 @@ class BitPBPTree {
iterator end() { return iterator(); } iterator end() { return iterator(); }
/** /**
* Alias for a function passed to the scan method. * Alias for a function passed to the scan method.
*/ */
...@@ -251,10 +254,10 @@ class BitPBPTree { ...@@ -251,10 +254,10 @@ class BitPBPTree {
* Constructor for creating a new B+ tree. * Constructor for creating a new B+ tree.
*/ */
explicit BitPBPTree(struct pobj_alloc_class_desc _alloc) : depth(0), alloc_class(_alloc) { explicit BitPBPTree(struct pobj_alloc_class_desc _alloc) : depth(0), alloc_class(_alloc) {
// BitPBPTree() : depth(0) { // BitPBPTree() : depth(0) {
rootNode = newLeafNode(); rootNode = newLeafNode();
LOG("created new tree with sizeof(BranchNode) = " << sizeof(BranchNode) << LOG("created new tree with sizeof(BranchNode) = "
", sizeof(LeafNode) = " << sizeof(LeafNode)); << sizeof(BranchNode) << ", sizeof(LeafNode) = " << sizeof(LeafNode));
} }
/** /**
...@@ -346,11 +349,12 @@ class BitPBPTree { ...@@ -346,11 +349,12 @@ class BitPBPTree {
* Print the structure and content of the B+ tree to stdout. * Print the structure and content of the B+ tree to stdout.
*/ */
void print() const { void print() const {
if (depth == 0) printLeafNode(0u, rootNode.leaf); if (depth == 0)
else printBranchNode(0u, rootNode.branch); printLeafNode(0u, rootNode.leaf);
else
printBranchNode(0u, rootNode.branch);
} }
/** /**
* Perform a scan over all key-value pairs stored in the B+ tree. * Perform a scan over all key-value pairs stored in the B+ tree.
* For each entry the given function @func is called. * For each entry the given function @func is called.
...@@ -404,7 +408,10 @@ class BitPBPTree { ...@@ -404,7 +408,10 @@ class BitPBPTree {
const auto &key = leafKeys[i]; const auto &key = leafKeys[i];
if (key < minKey) continue; if (key < minKey) continue;
if (key > maxKey) { higherThanMax = true; continue; }; if (key > maxKey) {
higherThanMax = true;
continue;
};
const auto &val = leafValues[i]; const auto &val = leafValues[i];
func(key, val); func(key, val);
...@@ -523,7 +530,7 @@ class BitPBPTree { ...@@ -523,7 +530,7 @@ class BitPBPTree {
--depth.get_rw(); --depth.get_rw();
} }
} }
} }
/** /**
* Merge two leaf nodes by moving all elements from @c node2 to @c node1. * Merge two leaf nodes by moving all elements from @c node2 to @c node1.
...@@ -532,7 +539,7 @@ class BitPBPTree { ...@@ -532,7 +539,7 @@ class BitPBPTree {
* @param node2 the source node * @param node2 the source node
* @return the merged node (always @c node1) * @return the merged node (always @c node1)
*/ */
pptr<LeafNode> mergeLeafNodes(const pptr<LeafNode> &node1, const pptr<LeafNode> &node2) { pptr<LeafNode> mergeLeafNodes(const pptr<LeafNode> &node1, const pptr<LeafNode> &node2) {
assert(node1 != nullptr); assert(node1 != nullptr);
assert(node2 != nullptr); assert(node2 != nullptr);
auto &node1Ref = *node1; auto &node1Ref = *node1;
...@@ -549,7 +556,7 @@ class BitPBPTree { ...@@ -549,7 +556,7 @@ class BitPBPTree {
const auto &node2Values = node2Ref.values.get_ro(); const auto &node2Values = node2Ref.values.get_ro();
for (auto i = 0u; i < M; ++i) { for (auto i = 0u; i < M; ++i) {
if (node2Bits.test(i)) { if (node2Bits.test(i)) {
const auto u = BitOperations::getFreeZero(node1Bits); const auto u = node1Bits.getFreeZero();
node1Keys[u] = node2Keys[i]; node1Keys[u] = node2Keys[i];
node1Values[u] = node2Values[i]; node1Values[u] = node2Values[i];
node1Bits.set(u); node1Bits.set(u);
...@@ -597,7 +604,7 @@ class BitPBPTree { ...@@ -597,7 +604,7 @@ class BitPBPTree {
/// move from one node to a node with larger keys /// move from one node to a node with larger keys
for (auto i = 0u; i < toMove; ++i) { for (auto i = 0u; i < toMove; ++i) {
const auto max = findMaxKeyPos(donorKeys, donorBits); const auto max = findMaxKeyPos(donorKeys, donorBits);
const auto u = BitOperations::getFreeZero(receiverBits); const auto u = receiverBits.getFreeZero();
/// move the donor's maximum key to the receiver /// move the donor's maximum key to the receiver
receiverKeys[u] = donorKeys[max]; receiverKeys[u] = donorKeys[max];
receiverValues[u] = donorValues[max]; receiverValues[u] = donorValues[max];
...@@ -608,7 +615,7 @@ class BitPBPTree { ...@@ -608,7 +615,7 @@ class BitPBPTree {
/// move from one node to a node with smaller keys /// move from one node to a node with smaller keys
for (auto i = 0u; i < toMove; ++i) { for (auto i = 0u; i < toMove; ++i) {
const auto min = findMinKeyPos(donorKeys, donorBits); const auto min = findMinKeyPos(donorKeys, donorBits);
const auto u = BitOperations::getFreeZero(receiverBits); const auto u = receiverBits.getFreeZero();
/// move the donor's minimum key to the receiver /// move the donor's minimum key to the receiver
receiverKeys[u] = donorKeys[min]; receiverKeys[u] = donorKeys[min];
receiverValues[u] = donorValues[min]; receiverValues[u] = donorValues[min];
...@@ -689,7 +696,7 @@ class BitPBPTree { ...@@ -689,7 +696,7 @@ class BitPBPTree {
const auto &nodeChilds = nodeRef.children.get_ro(); const auto &nodeChilds = nodeRef.children.get_ro();
auto &nodeBits = nodeRef.bits.get_rw(); auto &nodeBits = nodeRef.bits.get_rw();
const auto nMinKeyPos = findMinKeyPos(nodeKeys, nodeBits); const auto nMinKeyPos = findMinKeyPos(nodeKeys, nodeBits);
const auto prevPos = findMaxKeyPosSmallerThan(nodeKeys, nodeBits, nodeKeys[pos]); //could be N const auto prevPos = findMaxKeyPosSmallerThan(nodeKeys, nodeBits, nodeKeys[pos]); // could be N
const auto prevNumKeys = nodeChilds[prevPos].branch->bits.get_ro().count(); const auto prevNumKeys = nodeChilds[prevPos].branch->bits.get_ro().count();
const auto nextPos = findMinKeyPosGreaterThan(nodeKeys, nodeBits, nodeKeys[pos]); const auto nextPos = findMinKeyPosGreaterThan(nodeKeys, nodeBits, nodeKeys[pos]);
const auto nextNumKeys = nodeChilds[nextPos].branch->bits.get_ro().count(); const auto nextNumKeys = nodeChilds[nextPos].branch->bits.get_ro().count();
...@@ -715,8 +722,7 @@ class BitPBPTree { ...@@ -715,8 +722,7 @@ class BitPBPTree {
mergeBranchNodes(lSibling, nodeKeys[pos], child); mergeBranchNodes(lSibling, nodeKeys[pos], child);
deleteBranchNode(child); deleteBranchNode(child);
nodeBits.reset(pos); nodeBits.reset(pos);
if (pos == N) if (pos == N) nodeRef.children.get_rw()[N] = child; ///< new rightmost child
nodeRef.children.get_rw()[N] = child; ///< new rightmost child
return lSibling; return lSibling;
} else if (pos < N && nextNumKeys <= middle) { } else if (pos < N && nextNumKeys <= middle) {
/// merge from right /// merge from right
...@@ -725,10 +731,10 @@ class BitPBPTree { ...@@ -725,10 +731,10 @@ class BitPBPTree {
deleteBranchNode(rSibling); deleteBranchNode(rSibling);
nodeBits.reset(pos); nodeBits.reset(pos);
if (pos == findMaxKeyPos(nodeKeys, nodeBits)) if (pos == findMaxKeyPos(nodeKeys, nodeBits))
nodeRef.children.get_rw()[N] = child; ///< new rightmost child nodeRef.children.get_rw()[N] = child; ///< new rightmost child
return child; return child;
} else { } else {
assert(false); ///< shouldn't happen assert(false); ///< shouldn't happen
return child; return child;
} }
} }
...@@ -758,13 +764,13 @@ class BitPBPTree { ...@@ -758,13 +764,13 @@ class BitPBPTree {
assert(key <= nodeKeys[findMinKeyPos(nodeKeys, nodeBits)]); assert(key <= nodeKeys[findMinKeyPos(nodeKeys, nodeBits)]);
assert(sibKeys[findMaxKeyPos(sibKeys, sibBits)] < key); assert(sibKeys[findMaxKeyPos(sibKeys, sibBits)] < key);
auto u = BitOperations::getFreeZero(sibBits); auto u = sibBits.getFreeZero();
sibKeys[u] = key; sibKeys[u] = key;
sibChilds[u] = sibChilds[N]; sibChilds[u] = sibChilds[N];
sibBits.set(u); sibBits.set(u);
for (auto i = 0u; i < M; ++i) { for (auto i = 0u; i < M; ++i) {
if (nodeBits.test(i)) { if (nodeBits.test(i)) {
u = BitOperations::getFreeZero(sibBits); u = sibBits.getFreeZero();
sibKeys[u] = nodeKeys[i]; sibKeys[u] = nodeKeys[i];
sibChilds[u] = nodeChilds[i]; sibChilds[u] = nodeChilds[i];
sibBits.set(u); sibBits.set(u);
...@@ -804,17 +810,16 @@ class BitPBPTree { ...@@ -804,17 +810,16 @@ class BitPBPTree {
if (toMove == 0) return; if (toMove == 0) return;
/// 1. move from one node to a node with larger keys /// 1. move from one node to a node with larger keys
if (donorKeys[BitOperations::getFirstSet(donorBits)] < if (donorKeys[donorBits.getFirstSet()] < receiverKeys[receiverBits.getFirstSet()]) {
receiverKeys[BitOperations::getFirstSet(receiverBits)]) {
/// 1.1. copy parent key and rightmost child from donor /// 1.1. copy parent key and rightmost child from donor
auto u = BitOperations::getFreeZero(receiverBits); auto u = receiverBits.getFreeZero();
receiverKeys[u] = parentKeys[pos]; receiverKeys[u] = parentKeys[pos];
receiverChilds[u] = donorChilds[N]; receiverChilds[u] = donorChilds[N];
receiverBits.set(u); receiverBits.set(u);
/// 1.2. move toMove-1 keys/children from donor to receiver /// 1.2. move toMove-1 keys/children from donor to receiver
for (auto i = 1u; i < toMove; ++i) { for (auto i = 1u; i < toMove; ++i) {
const auto max = findMaxKeyPos(donorKeys, donorBits); const auto max = findMaxKeyPos(donorKeys, donorBits);
u = BitOperations::getFreeZero(receiverBits); u = receiverBits.getFreeZero();
receiverKeys[u] = donorKeys[max]; receiverKeys[u] = donorKeys[max];
receiverChilds[u] = donorChilds[max]; receiverChilds[u] = donorChilds[max];
receiverBits.set(u); receiverBits.set(u);
...@@ -826,16 +831,16 @@ class BitPBPTree { ...@@ -826,16 +831,16 @@ class BitPBPTree {
parentKeys[pos] = donorKeys[dPos]; parentKeys[pos] = donorKeys[dPos];
donorBits.reset(dPos); donorBits.reset(dPos);
/// 2. move from one node to a node with smaller keys /// 2. move from one node to a node with smaller keys
} else { } else {
/// 2.1. copy parent key and rightmost child of receiver /// 2.1. copy parent key and rightmost child of receiver
auto u = BitOperations::getFreeZero(receiverBits); auto u = receiverBits.getFreeZero();
receiverKeys[u] = parentKeys[pos]; receiverKeys[u] = parentKeys[pos];
receiverChilds[u] = receiverChilds[N]; receiverChilds[u] = receiverChilds[N];
receiverBits.set(u); receiverBits.set(u);
/// 2.2. move toMove-1 keys/children from donor to receiver /// 2.2. move toMove-1 keys/children from donor to receiver
for (auto i = 1u; i < toMove; ++i) { for (auto i = 1u; i < toMove; ++i) {
u = BitOperations::getFreeZero(receiverBits); u = receiverBits.getFreeZero();
const auto min = findMinKeyPos(donorKeys, donorBits); const auto min = findMinKeyPos(donorKeys, donorBits);
receiverKeys[u] = donorKeys[min]; receiverKeys[u] = donorKeys[min];
receiverChilds[u] = donorChilds[min]; receiverChilds[u] = donorChilds[min];
...@@ -874,7 +879,7 @@ class BitPBPTree { ...@@ -874,7 +879,7 @@ class BitPBPTree {
nodeRef.values.get_rw()[pos] = val; nodeRef.values.get_rw()[pos] = val;
return false; return false;
} }
const auto u = BitOperations::getFreeZero(nodeRef.bits.get_ro()); const auto u = nodeRef.bits.get_ro().getFreeZero();
if (u == M) { if (u == M) {
/// split the node /// split the node
splitLeafNode(node, splitInfo); splitLeafNode(node, splitInfo);
...@@ -884,14 +889,15 @@ class BitPBPTree { ...@@ -884,14 +889,15 @@ class BitPBPTree {
/// insert the new entry /// insert the new entry
if (key > splitRef.key) { if (key > splitRef.key) {
insertInLeafNodeAtPosition(sibling, BitOperations::getFreeZero(sibRef.bits.get_ro()), key, val); insertInLeafNodeAtPosition(sibling, sibRef.bits.get_ro().getFreeZero(), key, val);
} else { } else {
if (key > nodeRef.keys.get_ro()[findMaxKeyPos(nodeRef.keys.get_ro(), nodeRef.bits.get_ro())]) {