/*
 * File: plook_u32u8_bincka.c
 *
 * Code generated for Simulink model 'COMR_RtcCalc'.
 *
 * Model version                  : A1.0F_0
 * Simulink Coder version         : 8.11F (R2016b) 25-Aug-2016
 * C/C++ source code generated on : Fri May 24 10:20:56 2019
 */

#include "rtwtypes.h"
#include "binsearch_u32u8.h"
#include "plook_u32u8_bincka.h"

uint32_T plook_u32u8_bincka(uint8_T u, const uint8_T bp[], uint32_T maxIndex)
{
  uint32_T bpIndex;

  /* Prelookup - Index only
     Index Search method: 'binary'
     Extrapolation method: 'Clip'
     Use previous index: 'off'
     Use last breakpoint for index at or above upper limit: 'on'
     Remove protection against out-of-range input in generated code: 'off'
   */
  if (u <= bp[0U]) {
    bpIndex = 0U;
  } else if (u < bp[maxIndex]) {
    bpIndex = binsearch_u32u8(u, bp, maxIndex >> 1U, maxIndex);
  } else {
    bpIndex = maxIndex;
  }

  return bpIndex;
}

/*
 * File trailer for generated code.
 *
 * [EOF]
 */
