/*
 * File: div_u32_round.c
 *
 * Code generated for Simulink model 'RTC'.
 *
 * Company                        : AIWAYS
 * Author                         : zhangzy
 * Model version                  : 'M100C100'
 * Simulink Coder version         : 8.13 (R2017b) 24-Jul-2017
 * C/C++ source code generated on : Fri Oct 23 09:37:50 2020
 */

#include "rtwtypes.h"
#include "div_u32_round.h"

uint32_T div_u32_round(uint32_T numerator, uint32_T denominator)
{
  uint32_T quotient;
  if (denominator == 0U) {
    quotient = MAX_uint32_T;

    /* Divide by zero handler */
  } else {
    quotient = numerator / denominator;
    numerator %= denominator;
    if (numerator > 2147483647U) {
      quotient++;
    } else {
      numerator <<= 1U;
      if (numerator >= denominator) {
        quotient++;
      }
    }
  }

  return quotient;
}

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