Skip to content

Commit

Permalink
readability improvement
Browse files Browse the repository at this point in the history
  • Loading branch information
LevKruglyak committed Aug 2, 2023
1 parent 532ba6e commit 5bae27f
Showing 1 changed file with 10 additions and 8 deletions.
18 changes: 10 additions & 8 deletions limousine_core/src/classical/layer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -27,14 +27,16 @@ impl<K: Key, const FANOUT: usize> NodeLayer<K> for BTreeLayer<K, FANOUT> {
impl<K: Key, const FANOUT: usize> InternalLayer<K> for BTreeLayer<K, FANOUT> {
fn search(&self, key: &K, range: ApproxPos) -> ApproxPos {
// Small optimization for exact positions
let node = if range.lo == range.hi - 1 {
self.nodes[range.lo]
} else {
self.nodes[lower_bound(OptimalSearch::search_by_key_with_offset(
&self.nodes[range.lo..range.hi],
key,
range.lo,
))]
let node = {
if range.lo == range.hi - 1 {
self.nodes[range.lo]
} else {
self.nodes[lower_bound(OptimalSearch::search_by_key_with_offset(
&self.nodes[range.lo..range.hi],
key,
range.lo,
))]
}
};

let ptr = node.search(key);
Expand Down

0 comments on commit 5bae27f

Please sign in to comment.