This is an automated email from the ASF dual-hosted git repository. kmccusker pushed a commit to branch develop in repository https://gitbox.apache.org/repos/asf/incubator-milagro-crypto-rust.git
commit a3f47db5e7dd8bfde8a8677a854650d02dfe6953 Author: Kirk Baird <[email protected]> AuthorDate: Mon Mar 30 18:53:52 2020 +1100 Remove warnings Signed-off-by: Kirk Baird <[email protected]> --- src/big.rs | 12 ++++++------ src/ff.rs | 10 +++++----- src/fp.rs | 2 +- src/nhs.rs | 2 +- 4 files changed, 13 insertions(+), 13 deletions(-) diff --git a/src/big.rs b/src/big.rs index 0af6458..e4eca10 100644 --- a/src/big.rs +++ b/src/big.rs @@ -30,13 +30,13 @@ pub use super::rom::MODBYTES; use std::cmp::Ordering; use std::fmt; -pub const NLEN: usize = (1 + ((8 * MODBYTES - 1) / BASEBITS)); +pub const NLEN: usize = 1 + (8 * MODBYTES - 1) / BASEBITS; pub const DNLEN: usize = 2 * NLEN; -pub const BMASK: Chunk = ((1 << BASEBITS) - 1); -pub const HBITS: usize = (BASEBITS / 2); -pub const HMASK: Chunk = ((1 << HBITS) - 1); -pub const NEXCESS: isize = (1 << ((arch::CHUNK) - BASEBITS - 1)); -pub const BIGBITS: usize = (MODBYTES * 8); +pub const BMASK: Chunk = (1 << BASEBITS) - 1; +pub const HBITS: usize = BASEBITS / 2; +pub const HMASK: Chunk = (1 << HBITS) - 1; +pub const NEXCESS: isize = 1 << (arch::CHUNK - BASEBITS - 1); +pub const BIGBITS: usize = MODBYTES * 8; #[derive(Copy)] pub struct Big { diff --git a/src/ff.rs b/src/ff.rs index 90e7fdf..316c156 100644 --- a/src/ff.rs +++ b/src/ff.rs @@ -31,13 +31,13 @@ use super::super::arch::DChunk; pub use super::rom::FFLEN; //use std::str::SplitWhitespace; -pub const FF_BITS: usize = (big::BIGBITS * FFLEN); /* Finite Field Size in bits - must be 256.2^n */ -pub const HFLEN: usize = (FFLEN / 2); /* Useful for half-size RSA private key operations */ +pub const FF_BITS: usize = big::BIGBITS * FFLEN; /* Finite Field Size in bits - must be 256.2^n */ +pub const HFLEN: usize = FFLEN / 2; /* Useful for half-size RSA private key operations */ pub const P_MBITS: usize = (big::MODBYTES as usize) * 8; -pub const P_OMASK: Chunk = ((-1) << (P_MBITS % big::BASEBITS)); -pub const P_FEXCESS: Chunk = (1 << (big::BASEBITS * big::NLEN - P_MBITS - 1)); -pub const P_TBITS: usize = (P_MBITS % big::BASEBITS); +pub const P_OMASK: Chunk = (-1) << (P_MBITS % big::BASEBITS); +pub const P_FEXCESS: Chunk = 1 << (big::BASEBITS * big::NLEN - P_MBITS - 1); +pub const P_TBITS: usize = P_MBITS % big::BASEBITS; pub struct FF { v: Vec<Big>, diff --git a/src/fp.rs b/src/fp.rs index 45a828c..95cddff 100644 --- a/src/fp.rs +++ b/src/fp.rs @@ -54,7 +54,7 @@ pub use super::rom::{MOD8, MODBITS, MODTYPE, SH}; use std::fmt; use std::str::SplitWhitespace; -pub const FEXCESS: i32 = (((1 as i32) << SH) - 1); +pub const FEXCESS: i32 = ((1 as i32) << SH) - 1; pub const OMASK: Chunk = (-1) << (MODBITS % big::BASEBITS); pub const TBITS: usize = MODBITS % big::BASEBITS; // Number of active bits in top word pub const TMASK: Chunk = (1 << TBITS) - 1; diff --git a/src/nhs.rs b/src/nhs.rs index cf0f9c2..9a7f856 100644 --- a/src/nhs.rs +++ b/src/nhs.rs @@ -29,7 +29,7 @@ const ND: u32 = 0xF7002FFF; // 1/(R-q) mod R const ONE: i32 = 0x2AC8; // R mod q const R2MODP: u64 = 0x1620; // R^2 mod q -const DEGREE: usize = (1 << LGN); +const DEGREE: usize = 1 << LGN; const WL: usize = 32; const INV: i32 = 0xeab;
