@@ -89,8 +89,8 @@ impl<Key: Ord, Val: Ord> RelationLeaper<Key, Val> for Relation<(Key, Val)> {
89
89
}
90
90
91
91
mod extend_with {
92
-
93
- use super :: { Relation , Leaper , gallop , binary_search} ;
92
+ use join :: gallop ;
93
+ use super :: { Relation , Leaper , binary_search} ;
94
94
95
95
/// Wraps a Relation<Tuple> as a leaper.
96
96
pub struct ExtendWith < ' a , Key : Ord +' a , Val : Ord +' a , Tuple : Ord , Func : Fn ( & Tuple ) ->Key > {
@@ -139,8 +139,8 @@ mod extend_with {
139
139
}
140
140
141
141
mod extend_anti {
142
-
143
- use super :: { Relation , Leaper , gallop , binary_search} ;
142
+ use join :: gallop ;
143
+ use super :: { Relation , Leaper , binary_search} ;
144
144
145
145
/// Wraps a Relation<Tuple> as a leaper.
146
146
pub struct ExtendAnti < ' a , Key : Ord +' a , Val : Ord +' a , Tuple : Ord , Func : Fn ( & Tuple ) ->Key > {
@@ -283,26 +283,3 @@ fn binary_search<T>(slice: &[T], mut cmp: impl FnMut(&T)->bool) -> usize {
283
283
}
284
284
lo
285
285
}
286
-
287
- fn gallop < T > ( mut slice : & [ T ] , mut cmp : impl FnMut ( & T ) ->bool ) -> & [ T ] {
288
- // if empty slice, or already >= element, return
289
- if slice. len ( ) > 0 && cmp ( & slice[ 0 ] ) {
290
- let mut step = 1 ;
291
- while step < slice. len ( ) && cmp ( & slice[ step] ) {
292
- slice = & slice[ step..] ;
293
- step = step << 1 ;
294
- }
295
-
296
- step = step >> 1 ;
297
- while step > 0 {
298
- if step < slice. len ( ) && cmp ( & slice[ step] ) {
299
- slice = & slice[ step..] ;
300
- }
301
- step = step >> 1 ;
302
- }
303
-
304
- slice = & slice[ 1 ..] ; // advance one, as we always stayed < value
305
- }
306
-
307
- return slice;
308
- }
0 commit comments