fast_pow2() implemented.

This commit is contained in:
Jared Boone 2016-02-13 11:18:34 -08:00
parent d2531016e5
commit 64e4cde7f5
2 changed files with 10 additions and 0 deletions

View File

@ -73,6 +73,15 @@ float fast_log2(const float val) {
return log_2;
}
float fast_pow2(const float val) {
union {
float f;
uint32_t n;
} u;
u.n = val * 8388608 + (0x3f800000 - 60801 * 8);
return u.f;
}
float complex16_mag_squared_to_dbv_norm(const float c16_mag_squared) {
constexpr float input_component_max = 32768;
constexpr float mag2_max = (input_component_max * input_component_max) * 2;

View File

@ -70,6 +70,7 @@ constexpr size_t log_2(const size_t n, const size_t p = 0) {
}
float fast_log2(const float val);
float fast_pow2(const float val);
float complex16_mag_squared_to_dbv_norm(const float c16_mag_squared);