From fb7a827f32913b2d75d96cd895fe266e466f6769 Mon Sep 17 00:00:00 2001 From: David Tolnay Date: Sat, 11 Dec 2021 00:51:31 -0800 Subject: [PATCH] Resolve precedence clippy lint error: operator precedence can trip the unwary --> src/udiv128.rs:15:17 | 15 | let high2 = x_hi as u128 * y_lo as u128 + m_lo as u128 >> 64; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider parenthesizing your expression: `(x_hi as u128 * y_lo as u128 + m_lo as u128) >> 64` | = note: `-D clippy::precedence` implied by `-D clippy::all` = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#precedence --- src/udiv128.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/udiv128.rs b/src/udiv128.rs index 1c96d6f..df53eb5 100644 --- a/src/udiv128.rs +++ b/src/udiv128.rs @@ -12,7 +12,7 @@ fn u128_mulhi(x: u128, y: u128) -> u128 { let high1 = m >> 64; let m_lo = m as u64; - let high2 = x_hi as u128 * y_lo as u128 + m_lo as u128 >> 64; + let high2 = (x_hi as u128 * y_lo as u128 + m_lo as u128) >> 64; x_hi as u128 * y_hi as u128 + high1 + high2 }