Optimise usage of pow using fast equivalent and exp2 (#7548)

* replace std::pow with better performing equivalents

* revert one instance where I swapped to fastPow10f

* Negative slope instead of multiplying -1

Co-authored-by: saker <sakertooth@gmail.com>

---------

Co-authored-by: saker <sakertooth@gmail.com>
This commit is contained in:
Rossmaxx
2024-11-21 14:29:51 +05:30
committed by GitHub
parent 7e65a87ba8
commit 26d5241dd7
6 changed files with 18 additions and 17 deletions

View File

@@ -237,7 +237,7 @@ public:
static inline float freqFromWaveTableBand(int band)
{
return 440.0f * std::pow(2.0f, (band * OscillatorConstants::SEMITONES_PER_TABLE - 69.0f) / 12.0f);
return 440.0f * std::exp2((band * OscillatorConstants::SEMITONES_PER_TABLE - 69.0f) / 12.0f);
}
private: