diff --git a/Cargo.toml b/Cargo.toml index 8c5fc92..c6e5522 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -8,7 +8,7 @@ categories = ["algorithms", "science", "no-std"] license = "MIT OR Apache-2.0" repository = "https://github.com/rust-num/num-integer" name = "num-integer" -version = "0.1.46" +version = "0.2.0" readme = "README.md" exclude = ["/ci/*", "/.github/*"] edition = "2018" @@ -18,7 +18,7 @@ rust-version = "1.31" features = ["std"] [dependencies.num-traits] -version = "0.2.11" +version = "0.3.0" default-features = false features = ["i128"] @@ -28,3 +28,6 @@ std = ["num-traits/std"] # vestigial features, now always in effect i128 = [] + +[patch.crates-io] +num-traits = { git = "https://github.com/rickwebiii/num-traits.git", branch = "rweber/wrapping" } \ No newline at end of file diff --git a/benches/average.rs b/benches/average.rs index 1f81ca6..808d8d7 100644 --- a/benches/average.rs +++ b/benches/average.rs @@ -12,9 +12,23 @@ use test::{black_box, Bencher}; // --- Utilities for RNG ---------------------------------------------------- -trait BenchInteger: Integer + PrimInt + WrappingAdd + WrappingMul + 'static {} +trait BenchInteger: + Integer + + PrimInt + + WrappingAdd + + WrappingMul + + 'static +{ +} -impl BenchInteger for T where T: Integer + PrimInt + WrappingAdd + WrappingMul + 'static {} +impl BenchInteger for T where + T: Integer + + PrimInt + + WrappingAdd + + WrappingMul + + 'static +{ +} // Simple PRNG so we don't have to worry about rand compatibility fn lcg(x: T) -> T @@ -26,7 +40,7 @@ where // (but we're applying it to arbitrary sizes) const LCG_A: u32 = 1664525; const LCG_C: u32 = 1013904223; - x.wrapping_mul(&LCG_A.as_()).wrapping_add(&LCG_C.as_()) + x.wrapping_mul(LCG_A.as_()).wrapping_add(LCG_C.as_()) } // --- Alt. Implementations ------------------------------------------------- diff --git a/benches/roots.rs b/benches/roots.rs index b02ec86..9e8336e 100644 --- a/benches/roots.rs +++ b/benches/roots.rs @@ -9,9 +9,23 @@ use num_traits::checked_pow; use num_traits::{AsPrimitive, PrimInt, WrappingAdd, WrappingMul}; use test::{black_box, Bencher}; -trait BenchInteger: Integer + PrimInt + WrappingAdd + WrappingMul + 'static {} +trait BenchInteger: + Integer + + PrimInt + + WrappingAdd + + WrappingMul + + 'static +{ +} -impl BenchInteger for T where T: Integer + PrimInt + WrappingAdd + WrappingMul + 'static {} +impl BenchInteger for T where + T: Integer + + PrimInt + + WrappingAdd + + WrappingMul + + 'static +{ +} fn bench(b: &mut Bencher, v: &[T], f: F, n: u32) where @@ -55,7 +69,7 @@ where // (but we're applying it to arbitrary sizes) const LCG_A: u32 = 1664525; const LCG_C: u32 = 1013904223; - x.wrapping_mul(&LCG_A.as_()).wrapping_add(&LCG_C.as_()) + x.wrapping_mul(LCG_A.as_()).wrapping_add(LCG_C.as_()) } fn bench_rand(b: &mut Bencher, f: F, n: u32)