Skip to content

Commit fe19414

Browse files
committed
fixed existing issues
1 parent a1aec93 commit fe19414

File tree

3 files changed

+3
-6
lines changed

3 files changed

+3
-6
lines changed

src/ciphers/blake2b.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ fn add(a: &mut Word, b: Word) {
5555

5656
#[inline]
5757
const fn ceil(dividend: usize, divisor: usize) -> usize {
58-
(dividend / divisor) + ((dividend % divisor != 0) as usize)
58+
(dividend / divisor) + ((!dividend.is_multiple_of(divisor)) as usize)
5959
}
6060

6161
fn g(v: &mut [Word; 16], a: usize, b: usize, c: usize, d: usize, x: Word, y: Word) {

src/ciphers/diffie_hellman.rs

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -228,10 +228,7 @@ impl DiffieHellman {
228228
// Both parties now have the same shared secret key s which can be used for encryption or authentication.
229229

230230
pub fn new(group: Option<u8>) -> Self {
231-
let mut _group: u8 = 14;
232-
if let Some(x) = group {
233-
_group = x;
234-
}
231+
let _group = group.unwrap_or(14);
235232

236233
if !PRIMES.contains_key(&_group) {
237234
panic!("group not in primes")

src/machine_learning/loss_function/kl_divergence_loss.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ pub fn kld_loss(actual: &[f64], predicted: &[f64]) -> f64 {
1616
let loss: f64 = actual
1717
.iter()
1818
.zip(predicted.iter())
19-
.map(|(&a, &p)| ((a + eps) * ((a + eps) / (p + eps)).ln()))
19+
.map(|(&a, &p)| (a + eps) * ((a + eps) / (p + eps)).ln())
2020
.sum();
2121
loss
2222
}

0 commit comments

Comments
 (0)