Skip to content

Commit 049a194

Browse files
committed
Merge branch 'scan-boundary' into 0.0.5
2 parents 735eb17 + ea0af97 commit 049a194

File tree

2 files changed

+8
-186
lines changed

2 files changed

+8
-186
lines changed

bench/MemoryBTree/with-cache.mo

Lines changed: 0 additions & 184 deletions
This file was deleted.

src/MemoryBTree/Base.mo

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -996,12 +996,18 @@ module {
996996

997997
public func getInterval<K, V>(btree : MemoryBTree, btree_utils : BTreeUtils<K, V>, start : ?K, end : ?K) : (Nat, Nat) {
998998
let start_rank = switch (start) {
999-
case (?key) getIndex(btree, btree_utils, key);
999+
case (?key) switch (getExpectedIndex(btree, btree_utils, key)) {
1000+
case (#Found(index)) index;
1001+
case (#NotFound(index)) index;
1002+
};
10001003
case (null) 0;
10011004
};
10021005

10031006
let end_rank = switch (end) {
1004-
case (?key) getIndex(btree, btree_utils, key) + 1; // +1 because the end is exclusive
1007+
case (?key) switch (getExpectedIndex(btree, btree_utils, key)) {
1008+
case (#Found(index)) index + 1; // +1 because the end is exclusive
1009+
case (#NotFound(index)) index + 1; // +1 because the end is exclusive
1010+
};
10051011
case (null) btree.count;
10061012
};
10071013

0 commit comments

Comments
 (0)