simpler computation of uint_bits(), plus whitespace police

This commit is contained in:
Dave Herman 2010-10-20 22:04:19 -07:00
parent 9a539a5dd1
commit ce3224652f

View file

@ -9,18 +9,9 @@ import std._vec;
state type t = rec(vec[mutable uint] storage, uint nbits);
// FIXME: we should bind std.max_int
fn is32bit() -> bool {
let uint n = 0xffffffffu;
ret (n + 1u) == 0u;
}
// FIXME: this should be a constant once they work
fn uint_bits() -> uint {
if (is32bit()) {
ret 31u;
} else {
ret 63u;
}
ret 32u + ((1u << 32u) >> 27u) - 1u;
}
// FIXME: this should be state
@ -36,8 +27,6 @@ fn create(uint nbits, bool init) -> t {
nbits = nbits);
}
// FIXME: this should be state
fn process(fn(uint, uint) -> uint op, t v0, t v1) -> bool {
auto len = _vec.len[mutable uint](v1.storage);