1234567891011121314151617181920212223242526272829303132333435363738394041424344454647 |
- /*
- * File: div_repeat_s16s32_floor.c
- *
- * Code generated for Simulink model 'SOC'.
- *
- * Model version : 1.15
- * Simulink Coder version : 9.4 (R2020b) 29-Jul-2020
- * C/C++ source code generated on : Wed Aug 11 09:45:09 2021
- */
- #include "rtwtypes.h"
- #include "div_nzp_repeat_u32.h"
- #include "div_nzp_repeat_u32_ceiling.h"
- #include "div_repeat_s16s32_floor.h"
- int16_T div_repeat_s16s32_floor(int32_T numerator, int32_T denominator, uint32_T
- nRepeatSub)
- {
- uint32_T absDenominator;
- uint32_T absNumerator;
- int16_T quotient;
- if (denominator == 0) {
- quotient = (int16_T)(numerator >= 0 ? 32767 : -32768);
- /* Divide by zero handler */
- } else {
- absNumerator = numerator < 0 ? ~(uint32_T)numerator + 1U : (uint32_T)
- numerator;
- absDenominator = denominator < 0 ? ~(uint32_T)denominator + 1U : (uint32_T)
- denominator;
- if ((numerator < 0) != (denominator < 0)) {
- quotient = (int16_T)-(int32_T)div_nzp_repeat_u32_ceiling(absNumerator,
- absDenominator, nRepeatSub);
- } else {
- quotient = (int16_T)div_nzp_repeat_u32(absNumerator, absDenominator,
- nRepeatSub);
- }
- }
- return quotient;
- }
- /*
- * File trailer for generated code.
- *
- * [EOF]
- */
|