From ce3224652f22c5c81e81da3eb31de56683c9d8ec Mon Sep 17 00:00:00 2001 From: Dave Herman Date: Wed, 20 Oct 2010 22:04:19 -0700 Subject: simpler computation of uint_bits(), plus whitespace police --- src/comp/util/bits.rs | 15 ++------------- 1 file changed, 2 insertions(+), 13 deletions(-) (limited to 'src/comp') diff --git a/src/comp/util/bits.rs b/src/comp/util/bits.rs index fd456017..1208f1f7 100644 --- a/src/comp/util/bits.rs +++ b/src/comp/util/bits.rs @@ -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); -- cgit v1.2.3