@@ -87,8 +87,8 @@ use std::hash;
87
87
88
88
use vec:: Vec ;
89
89
90
- type Blocks < ' a > = Cloned < Items < ' a , u32 > >
91
- type MutBlocks < ' a > MutItems <' a, u32>;
90
+ type Blocks < ' a > = Cloned < Items < ' a , u32 > > ;
91
+ type MutBlocks < ' a > = MutItems < ' a , u32 > ;
92
92
type MatchWords < ' a > = Chain < Enumerate < Blocks < ' a > > , Skip < Take < Enumerate < Repeat < u32 > > > > > ;
93
93
94
94
// Take two BitV's, and return iterators of their words, where the shorter one
@@ -199,7 +199,7 @@ impl Bitv {
199
199
/// Iterator over mutable refs to the underlying blocks of data.
200
200
fn blocks_mut ( & mut self ) -> MutBlocks {
201
201
let blocks = blocks_for_bits ( self . len ( ) ) ;
202
- self . storage [ .. blocks] . iter_mut ( )
202
+ self . storage . slice_to_mut ( blocks) . iter_mut ( )
203
203
}
204
204
205
205
/// Iterator over the underlying blocks of data
@@ -336,7 +336,7 @@ impl Bitv {
336
336
assert ! ( i < self . nbits) ;
337
337
let w = i / u32:: BITS ;
338
338
let b = i % u32:: BITS ;
339
- self . storage . get ( w) . map ( |block|
339
+ self . storage . get ( w) . map ( |& block|
340
340
( block & ( 1 << b) ) != 0
341
341
)
342
342
}
@@ -835,10 +835,11 @@ impl Bitv {
835
835
if self . is_empty ( ) {
836
836
None
837
837
} else {
838
- let ret = self [ self . nbits - 1 ] ;
838
+ let i = self . nbits - 1 ;
839
+ let ret = self [ i] ;
839
840
// Second rule of Bitv Club
840
- self . set ( self . nbits - 1 , false ) ;
841
- self . nbits -= 1 ;
841
+ self . set ( i , false ) ;
842
+ self . nbits = i ;
842
843
Some ( ret)
843
844
}
844
845
}
0 commit comments