Codebase list rust-serde-xml-rs / 6a25f37
num-bigint: new upstream release Sylvestre Ledru 2 years ago
6 changed file(s) with 17 addition(s) and 273 deletion(s). Raw diff Collapse all Expand all
0 rust-num-bigint (0.4.3-1) UNRELEASED-FIXME-AUTOGENERATED-DEBCARGO; urgency=medium
1
2 * Team upload.
3 * Package num-bigint 0.4.3 from crates.io using debcargo 2.5.0
4
5 -- Sylvestre Ledru <sylvestre@debian.org> Sat, 18 Dec 2021 00:32:18 +0100
6
07 rust-num-bigint (0.2.6-1) unstable; urgency=medium
18
29 * Team upload.
3434
3535 Files: debian/*
3636 Copyright:
37 2018-2020 Debian Rust Maintainers <pkg-rust-maintainers@alioth-lists.debian.net>
38 2018-2020 kpcyrd <git@rxv.cc>
37 2018-2021 Debian Rust Maintainers <pkg-rust-maintainers@alioth-lists.debian.net>
38 2018-2021 kpcyrd <git@rxv.cc>
3939 License: MIT or Apache-2.0
4040
4141 License: Apache-2.0
99 ci/test_full.sh | 4 ++--
1010 4 files changed, 8 insertions(+), 5 deletions(-)
1111
12 --- a/benches/bigint.rs
13 +++ b/benches/bigint.rs
14 @@ -9,7 +9,8 @@
15
16 use num_bigint::{BigInt, BigUint, RandBigInt};
17 use num_traits::{FromPrimitive, Num, One, Pow, Zero};
18 -use rand::{SeedableRng, StdRng};
19 +use rand::rngs::StdRng;
20 +use rand::SeedableRng;
21 use std::mem::replace;
22 use test::Bencher;
23
24 --- a/benches/gcd.rs
25 +++ b/benches/gcd.rs
26 @@ -10,7 +10,8 @@
27 use num_bigint::{BigUint, RandBigInt};
28 use num_integer::Integer;
29 use num_traits::Zero;
30 -use rand::{SeedableRng, StdRng};
31 +use rand::rngs::StdRng;
32 +use rand::SeedableRng;
33 use test::Bencher;
34
35 fn get_rng() -> StdRng {
36 --- a/benches/roots.rs
37 +++ b/benches/roots.rs
38 @@ -8,7 +8,8 @@
39
40 use num_bigint::{BigUint, RandBigInt};
41 use num_traits::Pow;
42 -use rand::{SeedableRng, StdRng};
43 +use rand::rngs::StdRng;
44 +use rand::SeedableRng;
45 use test::Bencher;
46
47 // The `big64` cases demonstrate the speed of cases where the value
48 --- a/ci/test_full.sh
49 +++ b/ci/test_full.sh
50 @@ -33,7 +33,7 @@
51 cargo build --features="std $FEATURES"
52 cargo test --features="std $FEATURES"
53
54 -# make sure benchmarks can be built
55 +# make sure benchmarks can be built and sanity-tested
56 if [[ "$TRAVIS_RUST_VERSION" == "nightly" ]]; then
57 - cargo bench --all-features --no-run
58 + cargo test --benches --all-features
59 fi
0 diff --git a/src/bigrand.rs b/src/bigrand.rs
1 index 4a13b29..d0ff2e0 100644
2 --- a/src/bigrand.rs
3 +++ b/src/bigrand.rs
4 @@ -1,6 +1,6 @@
5 //! Randomization of big integers
6
7 -use rand::distributions::uniform::{SampleUniform, UniformSampler};
8 +use rand::distributions::uniform::{SampleUniform, UniformSampler, SampleBorrow};
9 use rand::prelude::*;
10 use rand::AsByteSliceMut;
11
12 @@ -124,16 +124,26 @@ impl UniformSampler for UniformBigUint {
13 type X = BigUint;
14
15 #[inline]
16 - fn new(low: Self::X, high: Self::X) -> Self {
17 + fn new<B1, B2>(low_b: B1, high_b: B2) -> Self
18 + where B1: SampleBorrow<Self::X> + Sized,
19 + B2: SampleBorrow<Self::X> + Sized
20 + {
21 + let low = low_b.borrow();
22 + let high = high_b.borrow();
23 assert!(low < high);
24 UniformBigUint {
25 - len: high - &low,
26 - base: low,
27 + len: high - low,
28 + base: low.clone(),
29 }
30 }
31
32 #[inline]
33 - fn new_inclusive(low: Self::X, high: Self::X) -> Self {
34 + fn new_inclusive<B1, B2>(low_b: B1, high_b: B2) -> Self
35 + where B1: SampleBorrow<Self::X> + Sized,
36 + B2: SampleBorrow<Self::X> + Sized
37 + {
38 + let low = low_b.borrow();
39 + let high = high_b.borrow();
40 assert!(low <= high);
41 Self::new(low, high + 1u32)
42 }
43 @@ -144,8 +154,11 @@ impl UniformSampler for UniformBigUint {
44 }
45
46 #[inline]
47 - fn sample_single<R: Rng + ?Sized>(low: Self::X, high: Self::X, rng: &mut R) -> Self::X {
48 - rng.gen_biguint_range(&low, &high)
49 + fn sample_single<R: Rng + ?Sized, B1, B2>(low: B1, high: B2, rng: &mut R) -> Self::X
50 + where B1: SampleBorrow<Self::X> + Sized,
51 + B2: SampleBorrow<Self::X> + Sized
52 + {
53 + rng.gen_biguint_range(low.borrow(), high.borrow())
54 }
55 }
56
57 @@ -164,16 +177,26 @@ impl UniformSampler for UniformBigInt {
58 type X = BigInt;
59
60 #[inline]
61 - fn new(low: Self::X, high: Self::X) -> Self {
62 + fn new<B1, B2>(low_b: B1, high_b: B2) -> Self
63 + where B1: SampleBorrow<Self::X> + Sized,
64 + B2: SampleBorrow<Self::X> + Sized
65 + {
66 + let low = low_b.borrow();
67 + let high = high_b.borrow();
68 assert!(low < high);
69 UniformBigInt {
70 - len: into_magnitude(high - &low),
71 - base: low,
72 + len: into_magnitude(high - low),
73 + base: low.clone(),
74 }
75 }
76
77 #[inline]
78 - fn new_inclusive(low: Self::X, high: Self::X) -> Self {
79 + fn new_inclusive<B1, B2>(low_b: B1, high_b: B2) -> Self
80 + where B1: SampleBorrow<Self::X> + Sized,
81 + B2: SampleBorrow<Self::X> + Sized
82 + {
83 + let low = low_b.borrow();
84 + let high = high_b.borrow();
85 assert!(low <= high);
86 Self::new(low, high + 1u32)
87 }
88 @@ -184,8 +207,11 @@ impl UniformSampler for UniformBigInt {
89 }
90
91 #[inline]
92 - fn sample_single<R: Rng + ?Sized>(low: Self::X, high: Self::X, rng: &mut R) -> Self::X {
93 - rng.gen_bigint_range(&low, &high)
94 + fn sample_single<R: Rng + ?Sized, B1, B2>(low: B1, high: B2, rng: &mut R) -> Self::X
95 + where B1: SampleBorrow<Self::X> + Sized,
96 + B2: SampleBorrow<Self::X> + Sized
97 + {
98 + rng.gen_bigint_range(low.borrow(), high.borrow())
99 }
100 }
101
102 diff --git a/tests/bigint.rs b/tests/bigint.rs
103 index 911bff0..59c8793 100644
104 --- a/tests/bigint.rs
105 +++ b/tests/bigint.rs
106 @@ -1093,7 +1093,7 @@ fn test_negative_shr() {
107 fn test_random_shr() {
108 use rand::distributions::Standard;
109 use rand::Rng;
110 - let mut rng = rand::thread_rng();
111 + let rng = rand::thread_rng();
112
113 for p in rng.sample_iter::<i64, _>(&Standard).take(1000) {
114 let big = BigInt::from(p);
115 diff --git a/tests/rand.rs b/tests/rand.rs
116 index 666b764..fb84b1f 100644
117 --- a/tests/rand.rs
118 +++ b/tests/rand.rs
119 @@ -3,6 +3,9 @@
120 extern crate num_bigint;
121 extern crate num_traits;
122 extern crate rand;
123 +extern crate rand_chacha;
124 +extern crate rand_isaac;
125 +extern crate rand_xorshift;
126
127 mod biguint {
128 use num_bigint::{BigUint, RandBigInt, RandomBits};
129 @@ -118,7 +121,7 @@ mod biguint {
130 "57401636903146945411652549098818446911814352529449356393690984105383482703074355\
131 67088360974672291353736011718191813678720755501317478656550386324355699624671",
132 ];
133 - use rand::prng::ChaChaRng;
134 + use rand_chacha::ChaChaRng;
135 seeded_value_stability::<ChaChaRng>(EXPECTED);
136 }
137
138 @@ -137,7 +140,7 @@ mod biguint {
139 "37805949268912387809989378008822038725134260145886913321084097194957861133272558\
140 43458183365174899239251448892645546322463253898288141861183340823194379722556",
141 ];
142 - use rand::prng::IsaacRng;
143 + use rand_isaac::IsaacRng;
144 seeded_value_stability::<IsaacRng>(EXPECTED);
145 }
146
147 @@ -156,7 +159,7 @@ mod biguint {
148 "53041498719137109355568081064978196049094604705283682101683207799515709404788873\
149 53417136457745727045473194367732849819278740266658219147356315674940229288531",
150 ];
151 - use rand::prng::XorShiftRng;
152 + use rand_xorshift::XorShiftRng;
153 seeded_value_stability::<XorShiftRng>(EXPECTED);
154 }
155 }
156 @@ -280,7 +283,7 @@ mod bigint {
157 "501454570554170484799723603981439288209930393334472085317977614690773821680884844\
158 8530978478667288338327570972869032358120588620346111979053742269317702532328",
159 ];
160 - use rand::prng::ChaChaRng;
161 + use rand_chacha::ChaChaRng;
162 seeded_value_stability::<ChaChaRng>(EXPECTED);
163 }
164
165 @@ -299,7 +302,7 @@ mod bigint {
166 "-14563174552421101848999036239003801073335703811160945137332228646111920972691151\
167 88341090358094331641182310792892459091016794928947242043358702692294695845817",
168 ];
169 - use rand::prng::IsaacRng;
170 + use rand_isaac::IsaacRng;
171 seeded_value_stability::<IsaacRng>(EXPECTED);
172 }
173
174 @@ -318,7 +321,7 @@ mod bigint {
175 "49920038676141573457451407325930326489996232208489690499754573826911037849083623\
176 24546142615325187412887314466195222441945661833644117700809693098722026764846",
177 ];
178 - use rand::prng::XorShiftRng;
179 + use rand_xorshift::XorShiftRng;
180 seeded_value_stability::<XorShiftRng>(EXPECTED);
181 }
182 }
183 diff --git a/tests/torture.rs b/tests/torture.rs
184 index 4f073d3..025fdeb 100644
185 --- a/tests/torture.rs
186 +++ b/tests/torture.rs
187 @@ -6,6 +6,7 @@ extern crate rand;
188
189 use num_bigint::RandBigInt;
190 use num_traits::Zero;
191 +use rand::rngs::SmallRng;
192 use rand::prelude::*;
193
194 fn test_mul_divide_torture_count(count: usize) {
0 --- a/Cargo.toml
1 +++ b/Cargo.toml
2 @@ -50,7 +50,7 @@
0 Index: num-bigint/Cargo.toml
1 ===================================================================
2 --- num-bigint.orig/Cargo.toml
3 +++ num-bigint/Cargo.toml
4 @@ -58,12 +58,12 @@ features = ["i128"]
35 default-features = false
46
57 [dependencies.quickcheck]
6 -version = "0.8"
8 -version = "1"
79 +version = "0.9"
810 optional = true
911 default-features = false
1012
11 @@ -60,8 +60,8 @@
12 default-features = false
13
1413 [dependencies.rand]
15 -version = "0.5"
16 -features = ["std"]
14 -version = "0.8"
1715 +version = "0.7"
18 +features = ["std", "small_rng"]
1916 optional = true
2017 default-features = false
2118
22 @@ -72,6 +72,16 @@
23 default-features = false
24 [dev-dependencies.serde_test]
25 version = "1.0"
26 +
27 +[dev-dependencies.rand_xorshift]
28 +version = "0.2.0"
29 +
30 +[dev-dependencies.rand_chacha]
31 +version = "0.2.0"
32 +
33 +[dev-dependencies.rand_isaac]
34 +version = "0.2.0"
35 +
36 [build-dependencies.autocfg]
37 version = "1"
38
00 relax-deps.patch
11 rand-0.7.patch
2 e7cdb537fdeafe471f9ee47834f7a34145c9fb8f.patch
2 #e7cdb537fdeafe471f9ee47834f7a34145c9fb8f.patch