Tease apart utility.hpp, other header dependencies.

Trying to get a host-testable FSK demodulator, and finding a lot of M4- and ChibiOS-specific code is getting included. Boo.
This commit is contained in:
Jared Boone 2015-10-15 15:17:40 -07:00
parent e049097f49
commit f82fd1f8d7
13 changed files with 135 additions and 64 deletions

View file

@ -26,8 +26,6 @@
#include <complex>
#include <cmath>
#include <hal.h>
constexpr float pi { 3.141592653589793238462643383279502884f };
namespace std {
@ -124,20 +122,4 @@ static_assert(sizeof(complex8_t) == 2, "complex8_t size wrong");
static_assert(sizeof(complex16_t) == 4, "complex16_t size wrong");
static_assert(sizeof(complex32_t) == 8, "complex32_t size wrong");
#if defined(LPC43XX_M4)
static inline complex32_t multiply_conjugate_s16_s32(const complex16_t::rep_type a, const complex16_t::rep_type b) {
// conjugate: conj(a + bj) = a - bj
// multiply: (a + bj) * (c + dj) = (ac - bd) + (bc + ad)j
// conjugate-multiply: (ac + bd) + (bc - ad)j
//return { a.real() * b.real() + a.imag() * b.imag(), a.imag() * b.real() - a.real() * b.imag() };
const int32_t rr = __SMULBB(a, b);
const int32_t ii = __SMULTT(a, b);
const int32_t r = __QADD(rr, ii);
const int32_t ir = __SMULTB(a, b);
const int32_t ri = __SMULBT(a, b);
const int32_t i = __QSUB(ir, ri);
return { r, i };
}
#endif
#endif/*__COMPLEX_H__*/