diff options
author | Joshua Yun <joshua@joshuayun.com> | 2025-03-13 23:16:14 -0500 |
---|---|---|
committer | Joshua Yun <joshua@joshuayun.com> | 2025-03-13 23:16:14 -0500 |
commit | 2b4e742f021a37fffcc5e557c4456c0a4ea77483 (patch) | |
tree | 2db677efc1bbe14149d4248dca61969cffa9e1c1 /Software/Drivers/CMSIS/DSP/DSP_Lib_TestSuite/RefLibs/src/BasicMathFunctions/shift.c | |
parent | 3ecbe307fbdbede75d8b66d50244c0f4260a8774 (diff) | |
download | sdr-master.tar.gz |
Diffstat (limited to 'Software/Drivers/CMSIS/DSP/DSP_Lib_TestSuite/RefLibs/src/BasicMathFunctions/shift.c')
-rw-r--r-- | Software/Drivers/CMSIS/DSP/DSP_Lib_TestSuite/RefLibs/src/BasicMathFunctions/shift.c | 73 |
1 files changed, 73 insertions, 0 deletions
diff --git a/Software/Drivers/CMSIS/DSP/DSP_Lib_TestSuite/RefLibs/src/BasicMathFunctions/shift.c b/Software/Drivers/CMSIS/DSP/DSP_Lib_TestSuite/RefLibs/src/BasicMathFunctions/shift.c new file mode 100644 index 0000000..3bc53ad --- /dev/null +++ b/Software/Drivers/CMSIS/DSP/DSP_Lib_TestSuite/RefLibs/src/BasicMathFunctions/shift.c @@ -0,0 +1,73 @@ +#include "ref.h"
+
+void ref_shift_q31(
+ q31_t * pSrc,
+ int8_t shiftBits,
+ q31_t * pDst,
+ uint32_t blockSize)
+{
+ uint32_t i;
+
+ if (shiftBits < 0)
+ {
+ for(i=0;i<blockSize;i++)
+ {
+ pDst[i] = pSrc[i] << shiftBits;
+ }
+ }
+ else
+ {
+ for(i=0;i<blockSize;i++)
+ {
+ pDst[i] = pSrc[i] >> -shiftBits;
+ }
+ }
+}
+
+void ref_shift_q15(
+ q15_t * pSrc,
+ int8_t shiftBits,
+ q15_t * pDst,
+ uint32_t blockSize)
+{
+ uint32_t i;
+
+ if (shiftBits < 0)
+ {
+ for(i=0;i<blockSize;i++)
+ {
+ pDst[i] = pSrc[i] << shiftBits;
+ }
+ }
+ else
+ {
+ for(i=0;i<blockSize;i++)
+ {
+ pDst[i] = pSrc[i] >> -shiftBits;
+ }
+ }
+}
+
+void ref_shift_q7(
+ q7_t * pSrc,
+ int8_t shiftBits,
+ q7_t * pDst,
+ uint32_t blockSize)
+{
+ uint32_t i;
+
+ if (shiftBits < 0)
+ {
+ for(i=0;i<blockSize;i++)
+ {
+ pDst[i] = pSrc[i] << shiftBits;
+ }
+ }
+ else
+ {
+ for(i=0;i<blockSize;i++)
+ {
+ pDst[i] = pSrc[i] >> -shiftBits;
+ }
+ }
+}
|