dsp/pll: style
This commit is contained in:
parent
47806a155d
commit
941a94bbf6
|
@ -49,7 +49,7 @@ impl PLL {
|
||||||
/// Returns:
|
/// Returns:
|
||||||
/// A tuple of instantaneous phase and frequency (the current phase increment).
|
/// A tuple of instantaneous phase and frequency (the current phase increment).
|
||||||
pub fn update(&mut self, x: i32, shift: u8) -> (i32, i32) {
|
pub fn update(&mut self, x: i32, shift: u8) -> (i32, i32) {
|
||||||
debug_assert!(shift >= 1 && shift <= 31);
|
debug_assert!((1..=30).contains(&shift));
|
||||||
let bias = 1i32 << shift;
|
let bias = 1i32 << shift;
|
||||||
let e = x.wrapping_sub(self.f);
|
let e = x.wrapping_sub(self.f);
|
||||||
self.f = self.f.wrapping_add(
|
self.f = self.f.wrapping_add(
|
||||||
|
@ -57,7 +57,7 @@ impl PLL {
|
||||||
);
|
);
|
||||||
self.x = x;
|
self.x = x;
|
||||||
let f = self.f.wrapping_add(
|
let f = self.f.wrapping_add(
|
||||||
bias.wrapping_add(e).wrapping_sub(self.y) >> shift - 1,
|
bias.wrapping_add(e).wrapping_sub(self.y) >> (shift - 1),
|
||||||
);
|
);
|
||||||
self.y = self.y.wrapping_add(f);
|
self.y = self.y.wrapping_add(f);
|
||||||
(self.y, f)
|
(self.y, f)
|
||||||
|
|
Loading…
Reference in New Issue