about summary refs log tree commit diff
path: root/src/lib
diff options
context:
space:
mode:
authorPatrick Walton <pcwalton@mimiga.net>2011-03-25 18:34:21 -0700
committerPatrick Walton <pcwalton@mimiga.net>2011-03-25 18:35:30 -0700
commit24a75eeccc7990e2c15e47c31283705f6091f752 (patch)
tree85ad91e31f3b2ccf1385a4992b05186ffe5e5d20 /src/lib
parentee686dacb8a2582309e6562d5c37b4cdc776482c (diff)
downloadrust-24a75eeccc7990e2c15e47c31283705f6091f752.tar.gz
rust-24a75eeccc7990e2c15e47c31283705f6091f752.zip
rustc: Parse definition IDs from crates; add a function to parse unsigned ints to the standard library
Diffstat (limited to 'src/lib')
-rw-r--r--src/lib/_uint.rs12
1 files changed, 12 insertions, 0 deletions
diff --git a/src/lib/_uint.rs b/src/lib/_uint.rs
index f456b7331bf..f6686b5d9aa 100644
--- a/src/lib/_uint.rs
+++ b/src/lib/_uint.rs
@@ -33,6 +33,18 @@ fn next_power_of_two(uint n) -> uint {
     ret tmp + 1u;
 }
 
+fn parse_buf(vec[u8] buf, uint radix) -> uint {
+    auto i = _vec.len[u8](buf) - 1u;
+    auto power = 1u;
+    auto n = 0u;
+    while (i >= 0u) {
+        n += (((buf.(i)) - ('0' as u8)) as uint) * power;
+        power *= radix;
+        i -= 1u;
+    }
+    ret n;
+}
+
 fn to_str(uint num, uint radix) -> str
 {
     auto n = num;