Skip to content

fix: excessive float conversion warnings#66

Draft
bryghtlabs-richard wants to merge 1 commit into
espressif:masterfrom
bryghtlabs-richard:fix/esp_codec_float_conv_warnings
Draft

fix: excessive float conversion warnings#66
bryghtlabs-richard wants to merge 1 commit into
espressif:masterfrom
bryghtlabs-richard:fix/esp_codec_float_conv_warnings

Conversation

@bryghtlabs-richard
Copy link
Copy Markdown

Fix warnings of this type by doing comparison more directly:

audio_forge.c: warning: using integer absolute value function 'abs' when argument is of floating-point type 'float' [-Wabsolute-value]
988 | if ((int)(abs((sonic_speed - audio_forge->sonic_speed) * 100)) <= 5) {
013 | if ((int)(abs((sonic_pitch - audio_forge->sonic_pitch) * 100)) <= 5) {

xtensa-esp-elf-gcc.exe (crosstool-NG esp-14.2.0_20251107) 14.2.0

Description

Working through building ESP-ADF example, found I cannot compile esp-codec cleanly, but we can simplify it slightly to make it better.

Testing

!Testing not yet done!


Checklist

Before submitting a Pull Request, please ensure the following:

  • 🚨 This PR does not introduce breaking changes.
  • All CI checks (GH Actions) pass.
  • Documentation is updated as needed.
  • Tests are updated or added as necessary.
  • Code is well-commented, especially in complex areas.
  • Git history is clean — commits are squashed to the minimum necessary.

Fix warnings of this type by doing comparison more directly:

audio_forge.c: warning: using integer absolute value function 'abs' when argument is of floating-point type 'float' [-Wabsolute-value]
988 |     if ((int)(abs((sonic_speed - audio_forge->sonic_speed) * 100)) <= 5) {
013 |     if ((int)(abs((sonic_pitch - audio_forge->sonic_pitch) * 100)) <= 5) {

xtensa-esp-elf-gcc.exe (crosstool-NG esp-14.2.0_20251107) 14.2.0
@bryghtlabs-richard
Copy link
Copy Markdown
Author

Oops - solves same issue as #27

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant