mirror of
https://github.com/rust-lang/rust.git
synced 2024-11-23 07:14:28 +00:00
stdlib: Fix a crazy underflow bug in _uint.parse_buf. Oops.
This commit is contained in:
parent
031e86ca2d
commit
73044b3455
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user