Skip to content

Commit

Permalink
Merge branch 'scan-boundary' into 0.0.5
Browse files Browse the repository at this point in the history
  • Loading branch information
tomijaga committed Jan 10, 2025
2 parents 735eb17 + ea0af97 commit 049a194
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 186 deletions.
184 changes: 0 additions & 184 deletions bench/MemoryBTree/with-cache.mo

This file was deleted.

10 changes: 8 additions & 2 deletions src/MemoryBTree/Base.mo
Original file line number Diff line number Diff line change
Expand Up @@ -996,12 +996,18 @@ module {

public func getInterval<K, V>(btree : MemoryBTree, btree_utils : BTreeUtils<K, V>, start : ?K, end : ?K) : (Nat, Nat) {
let start_rank = switch (start) {
case (?key) getIndex(btree, btree_utils, key);
case (?key) switch (getExpectedIndex(btree, btree_utils, key)) {
case (#Found(index)) index;
case (#NotFound(index)) index;
};
case (null) 0;
};

let end_rank = switch (end) {
case (?key) getIndex(btree, btree_utils, key) + 1; // +1 because the end is exclusive
case (?key) switch (getExpectedIndex(btree, btree_utils, key)) {
case (#Found(index)) index + 1; // +1 because the end is exclusive
case (#NotFound(index)) index + 1; // +1 because the end is exclusive
};
case (null) btree.count;
};

Expand Down

0 comments on commit 049a194

Please sign in to comment.