提交 f4d9dca1 编写于 作者: J Jonas Hietala 提交者: Alex Crichton

Group union, intersect and difference in Bitv.

上级 2e40078f
......@@ -170,28 +170,6 @@ pub fn with_capacity(nbits: uint, init: bool) -> 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 {
......@@ -229,6 +207,28 @@ pub fn negate(&mut self) {
for w in self.storage.mut_iter() { *w = !*w; }
}
/**
* 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
*
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册