mirror of
https://github.com/portapack-mayhem/mayhem-firmware.git
synced 2025-05-02 19:10:47 +00:00
fast_pow2() implemented.
This commit is contained in:
parent
d2531016e5
commit
64e4cde7f5
@ -73,6 +73,15 @@ float fast_log2(const float val) {
|
|||||||
return log_2;
|
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) {
|
float complex16_mag_squared_to_dbv_norm(const float c16_mag_squared) {
|
||||||
constexpr float input_component_max = 32768;
|
constexpr float input_component_max = 32768;
|
||||||
constexpr float mag2_max = (input_component_max * input_component_max) * 2;
|
constexpr float mag2_max = (input_component_max * input_component_max) * 2;
|
||||||
|
@ -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_log2(const float val);
|
||||||
|
float fast_pow2(const float val);
|
||||||
|
|
||||||
float complex16_mag_squared_to_dbv_norm(const float c16_mag_squared);
|
float complex16_mag_squared_to_dbv_norm(const float c16_mag_squared);
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user