Add a set_all function in bitv that's the inverse of clear
This commit is contained in:
parent
8cbdaf4f93
commit
ea1701de8c
@ -5,7 +5,6 @@
|
||||
|
||||
// FIXME: Almost all the functions in this module should be state fns, but the
|
||||
// effect system isn't currently working correctly.
|
||||
|
||||
state type t = rec(vec[mutable uint] storage, uint nbits);
|
||||
|
||||
// FIXME: this should be a constant once they work
|
||||
@ -114,6 +113,12 @@ fn clear(&t v) {
|
||||
}
|
||||
}
|
||||
|
||||
fn set_all(&t v) {
|
||||
for each (uint i in _uint::range(0u, v.nbits)) {
|
||||
set(v, i, true);
|
||||
}
|
||||
}
|
||||
|
||||
fn invert(&t v) {
|
||||
for each (uint i in uint::range(0u, vec::len(v.storage))) {
|
||||
v.storage.(i) = ~v.storage.(i);
|
||||
|
Loading…
x
Reference in New Issue
Block a user