auto merge of #15284 : apoelstra/rust/bitv-methods, r=cmr
The types `Bitv` and `BitvSet` are badly out of date. This PR: - cleans up the code (primarily, simplifies `Bitv` and implements `BitvSet` in terms of `Bitv`) - implements several new traits for `Bitv` - adds new functionality to `Bitv` and `BitvSet` - replaces internal iterators with external ones - updates documentation - minor bug fixes This is a significantly souped-up version of PR #15139 and is the result of the discussion there.
This commit is contained in:
commit
d611800a70
File diff suppressed because it is too large
Load Diff
@ -13,8 +13,8 @@ extern crate collections;
|
||||
use std::collections::Bitv;
|
||||
|
||||
fn bitv_test() {
|
||||
let mut v1 = box Bitv::new(31, false);
|
||||
let v2 = box Bitv::new(31, true);
|
||||
let mut v1 = box Bitv::with_capacity(31, false);
|
||||
let v2 = box Bitv::with_capacity(31, true);
|
||||
v1.union(v2);
|
||||
}
|
||||
|
||||
|
@ -16,7 +16,7 @@ use std::collections::Bitv;
|
||||
fn main() {
|
||||
// Generate sieve of Eratosthenes for n up to 1e6
|
||||
let n = 1000000u;
|
||||
let sieve = Bitv::new(n+1, true);
|
||||
let sieve = Bitv::with_capacity(n+1, true);
|
||||
let limit: uint = (n as f32).sqrt() as uint;
|
||||
for i in range(2, limit+1) {
|
||||
if sieve[i] {
|
||||
|
Loading…
x
Reference in New Issue
Block a user