Optimize pdm_continuous example
This commit is contained in:
parent
64154fec8c
commit
14eae9ca06
@ -68,8 +68,9 @@ fn fft_peak_freq(input: &[i16; 1024]) -> (usize, u32) {
|
||||
|
||||
result
|
||||
.iter()
|
||||
.map(|c| ((c.norm_sqr()*32768.0) as u32).sqrt())
|
||||
.map(|c| c.norm_sqr())
|
||||
.enumerate()
|
||||
.max_by(|(_, a), (_, b)| a.partial_cmp(b).unwrap_or(Ordering::Equal))
|
||||
.map(|(i, v)| (i, ((v*32768.0) as u32).sqrt()))
|
||||
.unwrap()
|
||||
}
|
Loading…
Reference in New Issue
Block a user