for n in 0..size { dst[n] = scale; }
},
WindowType::Sine => {
- let param;
- if half {
- param = consts::PI / ((2 * size) as f32);
- } else {
- param = consts::PI / (size as f32);
- }
+ let param = if half {
+ consts::PI / ((2 * size) as f32)
+ } else {
+ consts::PI / (size as f32)
+ };
for n in 0..size {
dst[n] = (((n as f32) + 0.5) * param).sin() * scale;
}
},
WindowType::KaiserBessel(alpha) => {
let dlen = if half { size as f32 } else { (size as f32) * 0.5 };
- let alpha2 = ((alpha * consts::PI / dlen) * (alpha * consts::PI / dlen)) as f64;
+ let alpha2 = f64::from((alpha * consts::PI / dlen) * (alpha * consts::PI / dlen));
let mut kb: Vec<f64> = Vec::with_capacity(size);
let mut sum = 0.0;
fn bessel_i0(inval: f64) -> f64 {
let mut val: f64 = 1.0;
for n in (1..64).rev() {
- val *= inval / ((n * n) as f64);
+ val *= inval / f64::from(n * n);
val += 1.0;
}
val