File tree Expand file tree Collapse file tree 1 file changed +12
-0
lines changed
Expand file tree Collapse file tree 1 file changed +12
-0
lines changed Original file line number Diff line number Diff line change 22
33#include < stdlib.h>
44#include < string.h>
5+ #ifdef __XTENSA__
56#include < xtensa/config/core-isa.h>
7+ #else
8+ #include < cmath>
9+ #endif
610
711namespace esp_audio_libs {
812namespace helix_decoder {
@@ -50,6 +54,7 @@ typedef long long Word64;
5054static __inline Word64 MADD64 (Word64 sum64, int x, int y) { return (sum64 + ((long long ) x * y)); }
5155
5256static __inline int MULSHIFT32 (int x, int y) {
57+ #ifdef __XTENSA__
5358 /* important rules for smull RdLo, RdHi, Rm, Rs:
5459 * RdHi and Rm can't be the same register
5560 * RdLo and Rm can't be the same register
@@ -63,12 +68,19 @@ static __inline int MULSHIFT32(int x, int y) {
6368 int ret;
6469 asm volatile (" mulsh %0, %1, %2" : " =r" (ret) : " r" (x), " r" (y));
6570 return ret;
71+ #else
72+ return ((uint64_t ) x * (uint64_t ) y >> 32 );
73+ #endif
6674}
6775
6876static __inline int FASTABS (int x) {
77+ #ifdef __XTENSA__
6978 int ret;
7079 asm volatile (" abs %0, %1" : " =r" (ret) : " r" (x));
7180 return ret;
81+ #else
82+ return std::abs (x);
83+ #endif
7284}
7385
7486static __inline Word64 SAR64 (Word64 x, int n) { return x >> n; }
You can’t perform that action at this time.
0 commit comments