mirror of
https://github.com/portapack-mayhem/mayhem-firmware.git
synced 2025-02-28 23:47:21 +00:00
Extract magnitude_squared to utility.
This commit is contained in:
parent
de0c884b67
commit
76df4f0369
@ -67,7 +67,6 @@
|
||||
|
||||
#include <cstdint>
|
||||
#include <cstddef>
|
||||
#include <complex>
|
||||
#include <array>
|
||||
#include <string>
|
||||
#include <bitset>
|
||||
@ -688,14 +687,6 @@ static void init() {
|
||||
);
|
||||
}
|
||||
|
||||
static inline float magnitude_squared(const std::complex<float> c) {
|
||||
const auto r = c.real();
|
||||
const auto r2 = r * r;
|
||||
const auto i = c.imag();
|
||||
const auto i2 = i * i;
|
||||
return r2 + i2;
|
||||
}
|
||||
|
||||
class EventDispatcher {
|
||||
public:
|
||||
MessageHandlerMap& message_handlers() {
|
||||
|
@ -25,6 +25,7 @@
|
||||
#include <type_traits>
|
||||
#include <cstdint>
|
||||
#include <cstddef>
|
||||
#include <complex>
|
||||
#include <memory>
|
||||
|
||||
#include <hal.h>
|
||||
@ -67,6 +68,14 @@ static inline void clear_m4_flag_saturation() {
|
||||
|
||||
float complex16_mag_squared_to_dbv_norm(const float c16_mag_squared);
|
||||
|
||||
inline float magnitude_squared(const std::complex<float> c) {
|
||||
const auto r = c.real();
|
||||
const auto r2 = r * r;
|
||||
const auto i = c.imag();
|
||||
const auto i2 = i * i;
|
||||
return r2 + i2;
|
||||
}
|
||||
|
||||
/* Override new/delete to use Chibi/OS heap functions */
|
||||
/* NOTE: Do not inline these, it doesn't work. ;-) */
|
||||
void* operator new(size_t size);
|
||||
|
Loading…
x
Reference in New Issue
Block a user