Skip to content

Commit f73ae54

Browse files
committed
Group union, intersect and difference in Bitv.
1 parent 329940a commit f73ae54

File tree

1 file changed

+22
-22
lines changed

1 file changed

+22
-22
lines changed

src/libcollections/bitv.rs

Lines changed: 22 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -170,28 +170,6 @@ impl Bitv {
170170
}
171171
}
172172

173-
/**
174-
* Calculates the union of two bitvectors
175-
*
176-
* Sets `self` to the union of `self` and `v1`. Both bitvectors must be
177-
* the same length. Returns `true` if `self` changed.
178-
*/
179-
#[inline]
180-
pub fn union(&mut self, other: &Bitv) -> bool {
181-
self.process(other, |w1, w2| w1 | w2)
182-
}
183-
184-
/**
185-
* Calculates the intersection of two bitvectors
186-
*
187-
* Sets `self` to the intersection of `self` and `v1`. Both bitvectors
188-
* must be the same length. Returns `true` if `self` changed.
189-
*/
190-
#[inline]
191-
pub fn intersect(&mut self, other: &Bitv) -> bool {
192-
self.process(other, |w1, w2| w1 & w2)
193-
}
194-
195173
/// Retrieve the value at index `i`
196174
#[inline]
197175
pub fn get(&self, i: uint) -> bool {
@@ -229,6 +207,28 @@ impl Bitv {
229207
for w in self.storage.mut_iter() { *w = !*w; }
230208
}
231209

210+
/**
211+
* Calculates the union of two bitvectors
212+
*
213+
* Sets `self` to the union of `self` and `v1`. Both bitvectors must be
214+
* the same length. Returns `true` if `self` changed.
215+
*/
216+
#[inline]
217+
pub fn union(&mut self, other: &Bitv) -> bool {
218+
self.process(other, |w1, w2| w1 | w2)
219+
}
220+
221+
/**
222+
* Calculates the intersection of two bitvectors
223+
*
224+
* Sets `self` to the intersection of `self` and `v1`. Both bitvectors
225+
* must be the same length. Returns `true` if `self` changed.
226+
*/
227+
#[inline]
228+
pub fn intersect(&mut self, other: &Bitv) -> bool {
229+
self.process(other, |w1, w2| w1 & w2)
230+
}
231+
232232
/**
233233
* Calculate the difference between two bitvectors
234234
*

0 commit comments

Comments
 (0)