mirror of
https://github.com/portapack-mayhem/mayhem-firmware.git
synced 2025-08-14 22:27:52 +00:00
SYNC
This commit is contained in:
@@ -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);
|
||||
|
Reference in New Issue
Block a user