fix clippy warnings
This commit is contained in:
Родитель
1e60918472
Коммит
a77c558047
|
@ -416,7 +416,7 @@ mod tests {
|
|||
// compute n = 2^\ell
|
||||
let n = ell.pow2();
|
||||
// compute m = sqrt(n) = 2^{\ell/2}
|
||||
let m = n.square_root();
|
||||
let m = (n as f64).sqrt() as usize;
|
||||
|
||||
// compute vector-matrix product between L and Z viewed as a matrix
|
||||
let LZ = (0..m)
|
||||
|
@ -455,7 +455,7 @@ mod tests {
|
|||
let ell = r.len();
|
||||
assert!(ell % 2 == 0); // ensure ell is even
|
||||
let n = ell.pow2();
|
||||
let m = n.square_root();
|
||||
let m = (n as f64).sqrt() as usize;
|
||||
|
||||
// compute row vector L
|
||||
for i in 0..m {
|
||||
|
|
|
@ -1,16 +1,10 @@
|
|||
pub trait Math {
|
||||
fn square_root(self) -> usize;
|
||||
fn pow2(self) -> usize;
|
||||
fn get_bits(self, num_bits: usize) -> Vec<bool>;
|
||||
fn log_2(self) -> usize;
|
||||
}
|
||||
|
||||
impl Math for usize {
|
||||
#[inline]
|
||||
fn square_root(self) -> usize {
|
||||
(self as f64).sqrt() as usize
|
||||
}
|
||||
|
||||
#[inline]
|
||||
fn pow2(self) -> usize {
|
||||
let base: usize = 2;
|
||||
|
|
|
@ -27,17 +27,10 @@ impl ScalarFromPrimitives for bool {
|
|||
|
||||
pub trait ScalarBytesFromScalar {
|
||||
fn decompress_scalar(s: &Scalar) -> ScalarBytes;
|
||||
fn decompress_vector(s: &[Scalar]) -> Vec<ScalarBytes>;
|
||||
}
|
||||
|
||||
impl ScalarBytesFromScalar for Scalar {
|
||||
fn decompress_scalar(s: &Scalar) -> ScalarBytes {
|
||||
ScalarBytes::from_bytes_mod_order(s.to_bytes())
|
||||
}
|
||||
|
||||
fn decompress_vector(s: &[Scalar]) -> Vec<ScalarBytes> {
|
||||
(0..s.len())
|
||||
.map(|i| Scalar::decompress_scalar(&s[i]))
|
||||
.collect::<Vec<ScalarBytes>>()
|
||||
}
|
||||
}
|
||||
|
|
Загрузка…
Ссылка в новой задаче