Use exported types in benchmark
This commit is contained in:
parent
22209e1480
commit
706bed1a79
|
@ -4,7 +4,7 @@ homepage = "http://parity.io"
|
|||
repository = "https://github.com/paritytech/parity-common"
|
||||
license = "MIT/Apache-2.0"
|
||||
name = "uint"
|
||||
version = "0.3.0"
|
||||
version = "0.3.1"
|
||||
authors = ["Parity Technologies <admin@parity.io>"]
|
||||
|
||||
[dependencies]
|
||||
|
|
|
@ -20,21 +20,14 @@ extern crate test;
|
|||
extern crate crunchy;
|
||||
#[macro_use]
|
||||
extern crate uint;
|
||||
|
||||
use uint::{U256, U512};
|
||||
// NOTE: constructing the type inside the benchmark crate is much faster so the
|
||||
// numbers for `U128` are better than they'd normally be.
|
||||
construct_uint!(U128, 2);
|
||||
construct_uint!(U256, 4);
|
||||
construct_uint!(U512, 8);
|
||||
|
||||
use test::{Bencher, black_box};
|
||||
|
||||
impl U256 {
|
||||
/// Multiplies two 256-bit integers to produce full 512-bit integer
|
||||
/// No overflow possible
|
||||
#[inline(always)]
|
||||
pub fn full_mul(self, other: U256) -> U512 {
|
||||
U512(uint_full_mul_reg!(U256, 4, self, other))
|
||||
}
|
||||
}
|
||||
|
||||
#[bench]
|
||||
fn u256_add(b: &mut Bencher) {
|
||||
b.iter(|| {
|
||||
|
|
|
@ -1376,4 +1376,14 @@ macro_rules! impl_quickcheck_arbitrary_for_uint {
|
|||
}
|
||||
|
||||
construct_uint!(U256, 4);
|
||||
construct_uint!(U512, 8);
|
||||
construct_uint!(U512, 8);
|
||||
|
||||
#[doc(hidden)]
|
||||
impl U256 {
|
||||
/// Multiplies two 256-bit integers to produce full 512-bit integer
|
||||
/// No overflow possible
|
||||
#[inline(always)]
|
||||
pub fn full_mul(self, other: U256) -> U512 {
|
||||
U512(uint_full_mul_reg!(U256, 4, self, other))
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue