/* Fast approximation to the trigonometric sine function for Q31 data.  */
q31_t arm_sin_q31(q31_t x)
/* Fast approximation to the trigonometric sine function for Q31 data.  */
q31_t arm_sin_q31(q31_t x)
{
  q31_t sinVal;
  int32_t index;
  q31_t a, b;
  q31_t fract;
  if (x < 0)
  {
    x = (uint32_t)x + 0x80000000;
  }
  index = (uint32_t)x >> FAST_MATH_Q31_SHIFT;
  fract = (x - (index << FAST_MATH_Q31_SHIFT)) << 9;
  a = sinTable_q31[index];
  b = sinTable_q31[index+1];
  sinVal = (q63_t) (0x80000000 - fract) * a >> 32;
  sinVal = (q31_t) ((((q63_t) sinVal << 32) + ((q63_t) fract * b)) >> 32);
  return (sinVal << 1);
}