Skip to content

Commit

Permalink
fix a logic bug in small_bitv.set
Browse files Browse the repository at this point in the history
  • Loading branch information
Dretch committed Aug 21, 2012
1 parent 9423302 commit 5ccd299
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion src/libstd/bitv.rs
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ struct small_bitv {
self.bits |= 1<<i;
}
else {
self.bits &= !(i as u32);
self.bits &= !(1<<i as u32);
}
}
#[inline(always)]
Expand Down Expand Up @@ -456,6 +456,14 @@ mod tests {
assert act.eq_vec(~[1u]);
}

#[test]
fn test_2_elements() {
let b = bitv::bitv(2, false);
b.set(0, true);
b.set(1, false);
assert b.to_str() == ~"10";
}

#[test]
fn test_10_elements() {
let mut act;
Expand Down

0 comments on commit 5ccd299

Please sign in to comment.