fix benchmark compilation (#1612)

This commit is contained in:
Robert Habermeier 2016-07-13 20:45:15 +02:00 committed by Gav Wood
parent 1b86f8368d
commit a7511b6b02

View File

@ -25,7 +25,6 @@ use test::Bencher;
use ethcore_util::hash::*;
use ethcore_util::bytes::*;
use ethcore_util::trie::*;
use ethcore_util::hashdb::*;
use ethcore_util::memorydb::*;
use ethcore_util::triehash::*;
use ethcore_util::sha3::*;
@ -34,10 +33,10 @@ use ethcore_util::sha3::*;
fn random_word(alphabet: &[u8], min_count: usize, diff_count: usize, seed: &mut H256) -> Vec<u8> {
assert!(min_count + diff_count <= 32);
*seed = seed.sha3();
let r = min_count + (seed.bytes()[31] as usize % (diff_count + 1));
let r = min_count + (seed[31] as usize % (diff_count + 1));
let mut ret: Vec<u8> = Vec::with_capacity(r);
for i in 0..r {
ret.push(alphabet[seed.bytes()[i] as usize % alphabet.len()]);
ret.push(alphabet[seed[i] as usize % alphabet.len()]);
}
ret
}
@ -45,15 +44,15 @@ fn random_word(alphabet: &[u8], min_count: usize, diff_count: usize, seed: &mut
fn random_bytes(min_count: usize, diff_count: usize, seed: &mut H256) -> Vec<u8> {
assert!(min_count + diff_count <= 32);
*seed = seed.sha3();
let r = min_count + (seed.bytes()[31] as usize % (diff_count + 1));
seed.bytes()[0..r].to_vec()
let r = min_count + (seed[31] as usize % (diff_count + 1));
seed[0..r].to_vec()
}
fn random_value(seed: &mut H256) -> Bytes {
*seed = seed.sha3();
match seed.bytes()[0] % 2 {
1 => vec![seed.bytes()[31];1],
_ => seed.bytes().to_vec(),
match seed[0] % 2 {
1 => vec![seed[31];1],
_ => seed.to_vec(),
}
}