Skip to content

Commit 1ff68ea

Browse files
cuviperGankra
authored andcommitted
---
yaml --- r: 165506 b: refs/heads/master c: 8f194de h: refs/heads/master v: v3
1 parent 77efcd7 commit 1ff68ea

File tree

2 files changed

+9
-8
lines changed

2 files changed

+9
-8
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
---
2-
refs/heads/master: 9c5101542d2a4983ade627bc593e16c0bb5f23ba
2+
refs/heads/master: 8f194de95d00fe540d848cc9a7d3e049ce3684ab
33
refs/heads/snap-stage1: e33de59e47c5076a89eadeb38f4934f58a3618a6
44
refs/heads/snap-stage3: 658529467d9d69ac9e09cacf98a6d61d781c2c76
55
refs/heads/try: aee614fc4973262a5a68efc643026e2b1458d65b

trunk/src/libcollections/bit.rs

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -87,8 +87,8 @@ use std::hash;
8787

8888
use vec::Vec;
8989

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>;
9292
type MatchWords<'a> = Chain<Enumerate<Blocks<'a>>, Skip<Take<Enumerate<Repeat<u32>>>>>;
9393

9494
// Take two BitV's, and return iterators of their words, where the shorter one
@@ -199,7 +199,7 @@ impl Bitv {
199199
/// Iterator over mutable refs to the underlying blocks of data.
200200
fn blocks_mut(&mut self) -> MutBlocks {
201201
let blocks = blocks_for_bits(self.len());
202-
self.storage[..blocks].iter_mut()
202+
self.storage.slice_to_mut(blocks).iter_mut()
203203
}
204204

205205
/// Iterator over the underlying blocks of data
@@ -336,7 +336,7 @@ impl Bitv {
336336
assert!(i < self.nbits);
337337
let w = i / u32::BITS;
338338
let b = i % u32::BITS;
339-
self.storage.get(w).map(|block|
339+
self.storage.get(w).map(|&block|
340340
(block & (1 << b)) != 0
341341
)
342342
}
@@ -835,10 +835,11 @@ impl Bitv {
835835
if self.is_empty() {
836836
None
837837
} else {
838-
let ret = self[self.nbits - 1];
838+
let i = self.nbits - 1;
839+
let ret = self[i];
839840
// 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;
842843
Some(ret)
843844
}
844845
}

0 commit comments

Comments
 (0)