Make Field::square take &self and return Self

This commit is contained in:
Jack Grigg
2019-12-12 23:09:28 +00:00
parent 9dac748224
commit cded08b0c5
24 changed files with 160 additions and 272 deletions

View File

@@ -210,8 +210,7 @@ fn bench_fq_square(b: &mut ::test::Bencher) {
let mut count = 0;
b.iter(|| {
let mut tmp = v[count];
tmp.square();
let tmp = v[count].square();
count = (count + 1) % SAMPLES;
tmp
});
@@ -264,11 +263,7 @@ fn bench_fq_sqrt(b: &mut ::test::Bencher) {
]);
let v: Vec<Fq> = (0..SAMPLES)
.map(|_| {
let mut tmp = Fq::random(&mut rng);
tmp.square();
tmp
})
.map(|_| Fq::random(&mut rng).square())
.collect();
let mut count = 0;