removed num library from dependencies

This commit is contained in:
debris 2015-12-04 11:40:54 +01:00
parent 98feaa4f16
commit 2805dfe22d
3 changed files with 12 additions and 7 deletions

View File

@ -16,7 +16,6 @@ rand = "0.3.12"
time = "0.1.34"
tiny-keccak = "1.0"
rocksdb = "0.2.1"
num = "0.1"
lazy_static = "0.1.*"
secp256k1 = "0.5.1"
rust-crypto = "0.2.34"

View File

@ -41,7 +41,6 @@
use std::collections::{HashMap};
use hash::*;
use sha3::*;
use num::pow;
/// Represents bloom index in cache
///
@ -119,13 +118,21 @@ impl<'a, D> ChainFilter<'a, D> where D: FilterDataSource
let mut filter = ChainFilter {
data_source: data_source,
index_size: index_size,
level_sizes: vec![]
// 0 level has always a size of 1
level_sizes: vec![1]
};
// cache level sizes, so we do not have to calculate them all the time
for i in 0..levels {
filter.level_sizes.push(pow(index_size, i as usize));
}
// eg. if levels == 3, index_size = 16
// level_sizes = [1, 16, 256]
let additional: Vec<usize> = (1..).into_iter()
.scan(1, |acc, _| {
*acc = *acc * index_size;
Some(*acc)
})
.take(levels as usize - 1)
.collect();
filter.level_sizes.extend(additional);
filter
}

View File

@ -32,7 +32,6 @@ extern crate mio;
extern crate rand;
extern crate rocksdb;
extern crate tiny_keccak;
extern crate num;
#[macro_use]
extern crate log;
#[macro_use]