Convert uint::parse_buf to ivecs
This commit is contained in:
parent
5f71a204d3
commit
544bdf05c5
@ -411,11 +411,10 @@ fn parse_def_id(buf: &[u8]) -> ast::def_id {
|
||||
let crate_part = ivec::slice[u8](buf, 0u, colon_idx);
|
||||
let def_part = ivec::slice[u8](buf, colon_idx + 1u, len);
|
||||
|
||||
// FIXME: Remove these ivec->vec conversions.
|
||||
let crate_part_vec = [];
|
||||
let def_part_vec = [];
|
||||
for b: u8 in crate_part { crate_part_vec += [b]; }
|
||||
for b: u8 in def_part { def_part_vec += [b]; }
|
||||
let crate_part_vec = ~[];
|
||||
let def_part_vec = ~[];
|
||||
for b: u8 in crate_part { crate_part_vec += ~[b]; }
|
||||
for b: u8 in def_part { def_part_vec += ~[b]; }
|
||||
|
||||
let crate_num = uint::parse_buf(crate_part_vec, 10u) as int;
|
||||
let def_num = uint::parse_buf(def_part_vec, 10u) as int;
|
||||
|
@ -42,9 +42,9 @@ fn next_power_of_two(n: uint) -> uint {
|
||||
ret tmp + 1u;
|
||||
}
|
||||
|
||||
fn parse_buf(buf: vec[u8], radix: uint) -> uint {
|
||||
if vec::len[u8](buf) == 0u { log_err "parse_buf(): buf is empty"; fail; }
|
||||
let i = vec::len[u8](buf) - 1u;
|
||||
fn parse_buf(buf: &[u8], radix: uint) -> uint {
|
||||
if ivec::len[u8](buf) == 0u { log_err "parse_buf(): buf is empty"; fail; }
|
||||
let i = ivec::len[u8](buf) - 1u;
|
||||
let power = 1u;
|
||||
let n = 0u;
|
||||
while true {
|
||||
|
@ -89,8 +89,7 @@ fn main(argv: vec[str]) {
|
||||
if opts.stress {
|
||||
stress(2);
|
||||
} else {
|
||||
let max = uint::parse_buf(ivec::to_vec(str::bytes(iargv.(1))),
|
||||
10u) as int;
|
||||
let max = uint::parse_buf(str::bytes(iargv.(1)), 10u) as int;
|
||||
|
||||
let num_trials = 10;
|
||||
|
||||
|
@ -20,7 +20,7 @@ fn main(args: vec[str]) {
|
||||
let n = if ivec::len(iargs) < 2u {
|
||||
10u
|
||||
} else {
|
||||
uint::parse_buf(ivec::to_vec(str::bytes(iargs.(1))), 10u)
|
||||
uint::parse_buf(str::bytes(iargs.(1)), 10u)
|
||||
};
|
||||
let i = 0u;
|
||||
while i < n {
|
||||
|
Loading…
x
Reference in New Issue
Block a user