diff options
| author | Jonas Hietala <tradet.h@gmail.com> | 2014-07-20 14:21:47 +0200 |
|---|---|---|
| committer | Alex Crichton <alex@alexcrichton.com> | 2014-07-21 09:54:31 -0700 |
| commit | f4d9dca10dfa73c7d1a9d3be7c63e943d29a43c9 (patch) | |
| tree | 8c095cd084948f21f38718db32c7f9382b855157 | |
| parent | 2e40078fc3325f336b1e0d27313d67ad6ae19419 (diff) | |
| download | rust-f4d9dca10dfa73c7d1a9d3be7c63e943d29a43c9.tar.gz rust-f4d9dca10dfa73c7d1a9d3be7c63e943d29a43c9.zip | |
Group union, intersect and difference in Bitv.
| -rw-r--r-- | src/libcollections/bitv.rs | 44 |
1 files changed, 22 insertions, 22 deletions
diff --git a/src/libcollections/bitv.rs b/src/libcollections/bitv.rs index 3521c4df6e7..3c95d500f16 100644 --- a/src/libcollections/bitv.rs +++ b/src/libcollections/bitv.rs @@ -170,28 +170,6 @@ impl Bitv { } } - /** - * Calculates the union of two bitvectors - * - * Sets `self` to the union of `self` and `v1`. Both bitvectors must be - * the same length. Returns `true` if `self` changed. - */ - #[inline] - pub fn union(&mut self, other: &Bitv) -> bool { - self.process(other, |w1, w2| w1 | w2) - } - - /** - * Calculates the intersection of two bitvectors - * - * Sets `self` to the intersection of `self` and `v1`. Both bitvectors - * must be the same length. Returns `true` if `self` changed. - */ - #[inline] - pub fn intersect(&mut self, other: &Bitv) -> bool { - self.process(other, |w1, w2| w1 & w2) - } - /// Retrieve the value at index `i` #[inline] pub fn get(&self, i: uint) -> bool { @@ -230,6 +208,28 @@ impl Bitv { } /** + * Calculates the union of two bitvectors + * + * Sets `self` to the union of `self` and `v1`. Both bitvectors must be + * the same length. Returns `true` if `self` changed. + */ + #[inline] + pub fn union(&mut self, other: &Bitv) -> bool { + self.process(other, |w1, w2| w1 | w2) + } + + /** + * Calculates the intersection of two bitvectors + * + * Sets `self` to the intersection of `self` and `v1`. Both bitvectors + * must be the same length. Returns `true` if `self` changed. + */ + #[inline] + pub fn intersect(&mut self, other: &Bitv) -> bool { + self.process(other, |w1, w2| w1 & w2) + } + + /** * Calculate the difference between two bitvectors * * Sets each element of `v0` to the value of that element minus the |
