diff options
| author | Patrick Walton <[email protected]> | 2011-04-27 11:45:53 -0700 |
|---|---|---|
| committer | Patrick Walton <[email protected]> | 2011-04-27 11:49:06 -0700 |
| commit | 73044b3455b7586557eabbd249023d0a363401d0 (patch) | |
| tree | 5bcf638357ed9fef32a0f99f2ff24c978cc1587b /src/lib/_uint.rs | |
| parent | Partly disable simplified-type glue optimization due to compile-time cost. (diff) | |
| download | rust-73044b3455b7586557eabbd249023d0a363401d0.tar.xz rust-73044b3455b7586557eabbd249023d0a363401d0.zip | |
stdlib: Fix a crazy underflow bug in _uint.parse_buf. Oops.
Diffstat (limited to 'src/lib/_uint.rs')
| -rw-r--r-- | src/lib/_uint.rs | 5 |
1 files changed, 2 insertions, 3 deletions
diff --git a/src/lib/_uint.rs b/src/lib/_uint.rs index f6686b5d..ce01dabf 100644 --- a/src/lib/_uint.rs +++ b/src/lib/_uint.rs @@ -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 |