IntDivMod
IntDivMod
Description
Generic quotient-and-remainder convenience macro.
Parameters
| Name | Direction | Description |
|---|---|---|
quotient |
out | Destination for the quotient |
remainder |
out | Destination for the remainder |
dividend |
in | Dividend |
divisor |
in | Divisor selected through generic dispatch |
Usage example (from documentation)
IntDivMod(&q, &r, &value, 97u);Usage example (Cross-references)
Usage examples (Cross-references)
- In
Int.c:925:
}
void(IntDivMod)(Int *quotient, Int *remainder, Int *dividend, Int *divisor) {
ValidateInt(quotient);
ValidateInt(remainder);- In
Int.c:988:
Int remainder = IntInit();
IntDivMod("ient, &remainder, dividend, divisor);
IntDeinit(&remainder);
int_replace(result, "ient);- In
Int.c:1005:
Int remainder = IntInit();
IntDivMod("ient, &remainder, dividend, divisor);
if (!IntIsZero(&remainder)) {
IntDeinit("ient);- In
Int.c:1050:
Int divisor_value = MISRA_PRIV_IntFromU64(divisor);
IntDivMod(quotient, remainder, dividend, &divisor_value);
IntDeinit(&divisor_value);
}- In
Int.c:1057:
Int divisor_value = MISRA_PRIV_IntFromI64(divisor);
IntDivMod(quotient, remainder, dividend, &divisor_value);
IntDeinit(&divisor_value);
}- In
Int.c:1073:
u64 rem = 0;
IntDivMod(quotient, &remainder, dividend, &divisor_value);
rem = IntToU64(&remainder);- In
Int.c:1085:
Int remainder = IntInit();
IntDivMod("ient, &remainder, dividend, divisor);
IntDeinit("ient);
int_replace(result, &remainder);- In
Int.c:1597:
Int next_r = IntInit();
IntDivMod(&q, &rem, &r, &new_r);
sint_mul_unsigned(&q_new_t, &new_t, &q);
sint_sub(&next_t, &t, &q_new_t);- In
Int.Math.c:300:
bool test_int_div_mod(void) {
WriteFmt("Testing IntDivMod generic dispatch\n");
Int dividend = IntFromStr("12345678901234567890");- In
Int.Math.c:307:
Str qtext = StrInit();
IntDivMod("ient, &remainder, ÷nd, 97u);
qtext = IntToStr("ient);- In
Int.Math.c:369:
bool test_int_div_mod_scalar(void) {
WriteFmt("Testing IntDivMod scalar-divisor dispatch\n");
Int dividend = IntFromStr("12345678901234567890");- In
Int.Math.c:376:
Str text = StrInit();
IntDivMod("ient, &remainder, ÷nd, 97);
text = IntToStr("ient);- In
Int.Math.c:847:
Int remainder = IntInit();
IntDivMod("ient, &remainder, ÷nd, &divisor);
return false;
}- In
Math.h:166:
/// TAGS: Int, Math, Divide, Modulo
///
void (IntDivMod)(Int *quotient, Int *remainder, Int *dividend, Int *divisor);
///
/// Compute the greatest common divisor of two integers.
- In
Math.h:561:
(divisor), \
Int: MISRA_PRIV_IntDivModValue, \
Int *: IntDivMod, \
const Int *: MISRA_PRIV_IntDivModConst, \
unsigned char: MISRA_PRIV_IntDivModU64, \
Last updated on