/* Process function for the floating-point Linear Interpolation Function.  */
float32_t arm_linear_interp_f32(arm_linear_interp_instance_f32 *S, float32_t x)
/* Process function for the floating-point Linear Interpolation Function.  */
float32_t arm_linear_interp_f32(arm_linear_interp_instance_f32 *S, float32_t x)
{
    float32_t y;
    float32_t x0, x1;
    float32_t y0, y1;
    float32_t xSpacing = S->xSpacing;
    int32_t i;
    float32_t *pYData = S->pYData;
    i = (int32_t) ((x - S->x1) / xSpacing);
    if (i < 0)
    {
      y = pYData[0];
    }
    else if ((uint32_t)i >= (S->nValues - 1))
    {
      y = pYData[S->nValues - 1];
    }
    else
    {
      x0 = S->x1 +  i      * xSpacing;
      x1 = S->x1 + (i + 1) * xSpacing;
      y0 = pYData[i];
      y1 = pYData[i + 1];
      y = y0 + (x - x0) * ((y1 - y0) / (x1 - x0));
    }
    return (y);
  }