/*
 * File: div_nzp_s32_floor.c
 *
 * Code generated for Simulink model 'BCMR_AChrg'.
 *
 * Model version                  : 1.1108
 * Simulink Coder version         : 8.11 (R2016b) 25-Aug-2016
 * C/C++ source code generated on : Thu Dec 10 15:40:35 2020
 */

#include "rtwtypes.h"
#include "div_nzp_s32_floor.h"

int32_T div_nzp_s32_floor(int32_T numerator, int32_T denominator)
{
  uint32_T absNumerator;
  uint32_T absDenominator;
  uint32_T tempAbsQuotient;
  boolean_T quotientNeedsNegation;
  absNumerator = numerator < 0 ? ~(uint32_T)numerator + 1U : (uint32_T)numerator;
  absDenominator = denominator < 0 ? ~(uint32_T)denominator + 1U : (uint32_T)
    denominator;
  quotientNeedsNegation = ((numerator < 0) != (denominator < 0));
  tempAbsQuotient = absNumerator / absDenominator;
  if (quotientNeedsNegation) {
    absNumerator %= absDenominator;
    if (absNumerator > 0U) {
      tempAbsQuotient++;
    }
  }

  return quotientNeedsNegation ? -(int32_T)tempAbsQuotient : (int32_T)
    tempAbsQuotient;
}

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