#include "look1_iflf_binlcapw.h" #include "rtwtypes.h" real32_T look1_iflf_binlcapw(real32_T u0, const real32_T bp0[], const real32_T table[], uint32_T maxIndex) { real32_T frac; real32_T y; uint32_T iLeft; if (u0 <= bp0[0U]) { iLeft = 0U; frac = 0.0F; } else if (u0 < bp0[maxIndex]) { uint32_T bpIdx; uint32_T iRght; bpIdx = maxIndex >> 1U; iLeft = 0U; iRght = maxIndex; while (iRght - iLeft > 1U) { if (u0 < bp0[bpIdx]) { iRght = bpIdx; } else { iLeft = bpIdx; } bpIdx = (iRght + iLeft) >> 1U; } frac = (u0 - bp0[iLeft]) / (bp0[iLeft + 1U] - bp0[iLeft]); } else { iLeft = maxIndex; frac = 0.0F; } if (iLeft == maxIndex) { y = table[iLeft]; } else { real32_T yL_0d0; yL_0d0 = table[iLeft]; y = (table[iLeft + 1U] - yL_0d0) * frac + yL_0d0; } return y; }