aboutsummaryrefslogtreecommitdiff
path: root/src/comp/util
diff options
context:
space:
mode:
authorDave Herman <[email protected]>2010-10-20 22:04:19 -0700
committerDave Herman <[email protected]>2010-10-20 22:04:19 -0700
commitce3224652f22c5c81e81da3eb31de56683c9d8ec (patch)
tree96f62ab18b8e4560efced37f91e640b204359962 /src/comp/util
parentMove the "friendly" type printer to semant (diff)
downloadrust-ce3224652f22c5c81e81da3eb31de56683c9d8ec.tar.xz
rust-ce3224652f22c5c81e81da3eb31de56683c9d8ec.zip
simpler computation of uint_bits(), plus whitespace police
Diffstat (limited to 'src/comp/util')
-rw-r--r--src/comp/util/bits.rs15
1 files changed, 2 insertions, 13 deletions
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);