From 13b47556fd3f62e1356a4d0c64c43aebff823234 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Robert=20J=C3=B6rdens?= Date: Wed, 10 Feb 2021 13:27:56 +0100 Subject: [PATCH] lowpass: clippy --- dsp/src/lockin.rs | 2 +- dsp/src/lowpass.rs | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/dsp/src/lockin.rs b/dsp/src/lockin.rs index d78c01b..75c7b97 100644 --- a/dsp/src/lockin.rs +++ b/dsp/src/lockin.rs @@ -12,7 +12,7 @@ impl Lockin { pub fn new(k: u8) -> Self { let lp = Lowpass::default(); Self { - state: [lp.clone(), lp.clone()], + state: [lp.clone(), lp], k, } } diff --git a/dsp/src/lowpass.rs b/dsp/src/lowpass.rs index e3a1353..b85e2ed 100644 --- a/dsp/src/lowpass.rs +++ b/dsp/src/lowpass.rs @@ -27,7 +27,7 @@ impl> Lowpass { let mut x1 = self.xy[0]; self.xy[0] = x; for y1 in self.xy[1..].iter_mut() { - x0 = *y1 + (((x0 >> 1) + (x1 >> 1) - *y1 + (1 << k - 1)) >> k); + x0 = *y1 + (((x0 >> 1) + (x1 >> 1) - *y1 + (1 << (k - 1))) >> k); x1 = *y1; *y1 = x0; }