Subversion Repositories FuelGauge

Rev

Blame | Last modification | View Log | Download | RSS feed

  1. #include "ref.h"
  2.  
  3. void ref_shift_q31(
  4.   q31_t * pSrc,
  5.   int8_t shiftBits,
  6.   q31_t * pDst,
  7.   uint32_t blockSize)
  8. {
  9.         uint32_t i;
  10.        
  11.         if (shiftBits < 0)
  12.         {
  13.                 for(i=0;i<blockSize;i++)
  14.                 {
  15.                         pDst[i] = pSrc[i] << shiftBits;
  16.                 }
  17.         }
  18.         else
  19.         {
  20.                 for(i=0;i<blockSize;i++)
  21.                 {
  22.                         pDst[i] = pSrc[i] >> -shiftBits;
  23.                 }
  24.         }
  25. }
  26.  
  27. void ref_shift_q15(
  28.   q15_t * pSrc,
  29.   int8_t shiftBits,
  30.   q15_t * pDst,
  31.   uint32_t blockSize)
  32. {
  33.         uint32_t i;
  34.        
  35.         if (shiftBits < 0)
  36.         {
  37.                 for(i=0;i<blockSize;i++)
  38.                 {
  39.                         pDst[i] = pSrc[i] << shiftBits;
  40.                 }
  41.         }
  42.         else
  43.         {
  44.                 for(i=0;i<blockSize;i++)
  45.                 {
  46.                         pDst[i] = pSrc[i] >> -shiftBits;
  47.                 }
  48.         }
  49. }
  50.  
  51. void ref_shift_q7(
  52.   q7_t * pSrc,
  53.   int8_t shiftBits,
  54.   q7_t * pDst,
  55.   uint32_t blockSize)
  56. {
  57.         uint32_t i;
  58.        
  59.         if (shiftBits < 0)
  60.         {
  61.                 for(i=0;i<blockSize;i++)
  62.                 {
  63.                         pDst[i] = pSrc[i] << shiftBits;
  64.                 }
  65.         }
  66.         else
  67.         {
  68.                 for(i=0;i<blockSize;i++)
  69.                 {
  70.                         pDst[i] = pSrc[i] >> -shiftBits;
  71.                 }
  72.         }
  73. }
  74.