Remove constexpr use of std::log2, std::log10.

GCC 4.9 doesn't care for it.
This commit is contained in:
Jared Boone 2016-02-19 10:30:26 -08:00
parent d6d1f6b8af
commit daeb542086

View File

@ -22,7 +22,6 @@
#include "utility.hpp" #include "utility.hpp"
#include <cstdint> #include <cstdint>
#include <cmath>
#if 0 #if 0
uint32_t gcd(const uint32_t u, const uint32_t v) { uint32_t gcd(const uint32_t u, const uint32_t v) {
@ -84,10 +83,9 @@ float fast_pow2(const float val) {
} }
float mag2_to_dbv_norm(const float mag2) { float mag2_to_dbv_norm(const float mag2) {
constexpr float mag2_max = 1.0f; constexpr float mag2_log2_max = 0.0f; //std::log2(1.0f);
constexpr float mag2_log2_max = std::log2(mag2_max);
constexpr float log_mag2_mag_factor = 0.5f; constexpr float log_mag2_mag_factor = 0.5f;
constexpr float log2_log10_factor = std::log10(2.0f); constexpr float log2_log10_factor = 0.3010299956639812f; //std::log10(2.0f);
constexpr float log10_dbv_factor = 20.0f; constexpr float log10_dbv_factor = 20.0f;
constexpr float mag2_to_db_factor = log_mag2_mag_factor * log2_log10_factor * log10_dbv_factor; constexpr float mag2_to_db_factor = log_mag2_mag_factor * log2_log10_factor * log10_dbv_factor;
return (fast_log2(mag2) - mag2_log2_max) * mag2_to_db_factor; return (fast_log2(mag2) - mag2_log2_max) * mag2_to_db_factor;