From ea1701de8c9ff1b2e5a92c07daa07d9d444d6c51 Mon Sep 17 00:00:00 2001 From: Tim Chevalier Date: Wed, 18 May 2011 15:38:11 -0700 Subject: [PATCH] Add a set_all function in bitv that's the inverse of clear --- src/lib/bitv.rs | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/lib/bitv.rs b/src/lib/bitv.rs index 708cc621868b..5ea8e456684c 100644 --- a/src/lib/bitv.rs +++ b/src/lib/bitv.rs @@ -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);