stdlib: Fix a crazy underflow bug in _uint.parse_buf. Oops.

This commit is contained in:
Patrick Walton 2011-04-27 11:45:53 -07:00
parent 031e86ca2d
commit 73044b3455

View File

@ -37,12 +37,11 @@ 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) {
while (true) {
n += (((buf.(i)) - ('0' as u8)) as uint) * power;
power *= radix;
i -= 1u;
if (i == 0u) { ret n; }
}
ret n;
}
fn to_str(uint num, uint radix) -> str