@@ -38,9 +38,6 @@ bool BtreeStorage::add(const void *newItem) {
3838 // given the insert position, work out the number of items to move
3939 int amtToMove = (currentSize - insertionPoint);
4040
41- // for debugging
42- // serdebugF4("add ", insertionPoint, keyAccessor(newItem), amtToMove);
43-
4441 // move the instances in reverse order using their assignment operator.
4542 if (amtToMove > 0 ) {
4643 for (bsize_t i = insertionPoint + amtToMove; i > insertionPoint; --i) {
@@ -86,13 +83,12 @@ bsize_t BtreeStorage::nearestLocation(uint32_t key) {
8683 else if (currentSize == 1 ) return (key <= keyAccessor (binTree)) ? 0 : 1 ;
8784 else if (key > keyAccessor (memoryOf (binTree, currentSize - 1 ))) return currentSize;
8885
89- // otherwise we search with binary chop
86+ // otherwise, we search with binary chop
9087 bsize_t start = 0 ;
9188 bsize_t end = currentSize - 1 ;
9289 bsize_t midPoint;
9390 while ((end - start) > 1 ) {
9491 midPoint = start + ((end - start) / 2 );
95- // serdebugF4("start mid end", start, midPoint, end);
9692 auto midKey = keyAccessor (memoryOf (binTree, midPoint));
9793 if (midKey == key) return midPoint;
9894 else if (midKey > key) end = midPoint;
@@ -115,6 +111,5 @@ bsize_t BtreeStorage::nearestLocation(uint32_t key) {
115111void *BtreeStorage::getByKey (uint32_t key) {
116112 if (currentSize == 0 ) return nullptr ;
117113 bsize_t loc = nearestLocation (key);
118- // serdebugF3("getByKey ", loc, key);
119114 return (keyAccessor (memoryOf (binTree, loc)) == key && loc < currentSize) ? memoryOf (binTree, loc) : nullptr ;
120115}
0 commit comments