This commit is contained in:
furrtek
2016-01-31 09:34:24 +01:00
parent 29ec87a9ad
commit 44638e504b
166 changed files with 8700 additions and 3967 deletions

View File

@@ -26,20 +26,14 @@
#include <hal.h>
static inline bool m4_flag_saturation() {
return __get_APSR() & (1U << 27);
}
static inline void clear_m4_flag_saturation() {
uint32_t flags = 1;
__asm volatile ("MSR APSR_nzcvqg, %0" : : "r" (flags));
}
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() };
// NOTE: Did not use combination of SMUAD and SMUSDX because of non-saturating arithmetic.
// const int32_t r = __SMUAD(a, b);
// const int32_t i = __SMUSDX(b, a);
const int32_t rr = __SMULBB(a, b);
const int32_t ii = __SMULTT(a, b);
const int32_t r = __QADD(rr, ii);