Skip to content

Commit

Permalink
Fix likely unintentional cast (issue #143)
Browse files Browse the repository at this point in the history
  • Loading branch information
marin-m committed Dec 24, 2023
1 parent 2986282 commit d40f184
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/fingerprinting/algorithm.rs
Original file line number Diff line number Diff line change
Expand Up @@ -243,7 +243,7 @@ impl SignatureGenerator {
let peak_variation_1: f32 = peak_magnitude * 2.0 - peak_magnitude_before - peak_magnitude_after;
let peak_variation_2: f32 = (peak_magnitude_after - peak_magnitude_before) * 32.0 / peak_variation_1;

let corrected_peak_frequency_bin: u16 = bin_position as u16 * 64 + peak_variation_2 as u16;
let corrected_peak_frequency_bin: u16 = bin_position as u16 * 64 + (peak_variation_2 as i16) as u16;

assert!(peak_variation_1 >= 0.0);

Expand Down

0 comments on commit d40f184

Please sign in to comment.