1 /* 2 * poly.c 3 * 4 * Copyright (c) 1998-2018, Arm Limited. 5 * SPDX-License-Identifier: MIT 6 */ 7 __kernel_poly(const double * coeffs,int n,double x)8double __kernel_poly(const double *coeffs, int n, double x) 9 { 10 double result = coeffs[--n]; 11 12 while ((n & ~0x6) != 0) /* Loop until n even and < 8 */ 13 result = (result * x) + coeffs[--n]; 14 15 switch (n) 16 { 17 case 6: result = (result * x) + coeffs[5]; 18 result = (result * x) + coeffs[4]; 19 case 4: result = (result * x) + coeffs[3]; 20 result = (result * x) + coeffs[2]; 21 case 2: result = (result * x) + coeffs[1]; 22 result = (result * x) + coeffs[0]; 23 } 24 return result; 25 } 26