IntMul
IntMul
Description
Generic multiplication convenience macro.
Parameters
| Name | Direction | Description |
|---|---|---|
result |
out | Destination for the product |
a |
in | Left operand |
b |
in | Right operand selected through generic dispatch |
Usage example (from documentation)
IntMul(&product, &value, 10u);Usage example (Cross-references)
Usage examples (Cross-references)
- In
Float.c:98:
Int scaled = IntInit();
IntMul(&scaled, &value->significand, &factor);
IntDeinit(&factor);
IntDeinit(&value->significand);- In
Float.c:238:
temp = IntClone(&value->significand);
factor = float_pow10((u64)value->exponent);
IntMul(&temp, &temp, &factor);
IntDeinit(&factor);- In
Float.c:587:
ValidateFloat(b);
IntMul(&temp.significand, &a->significand, &b->significand);
temp.negative = FloatIsNegative(a) != FloatIsNegative(b);
temp.exponent = float_add_i64_checked(a->exponent, b->exponent);- In
Float.c:649:
scale = float_pow10(precision);
IntMul(&scaled, &a->significand, &scale);
IntDiv(&temp.significand, &scaled, &b->significand);- In
Int.c:147:
SignedInt temp = sint_init();
IntMul(&temp.magnitude, &a->magnitude, b);
temp.negative = a->negative;
sint_normalize(&temp);- In
Int.c:173:
Int result = IntInit();
IntMul(&result, &lhs, &rhs);
IntDeinit(&lhs);- In
Int.c:816:
}
void(IntMul)(Int *result, Int *a, Int *b) {
ValidateInt(result);
ValidateInt(a);- In
Int.c:872:
void IntSquare(Int *result, Int *value) {
IntMul(result, value, value);
}- In
Int.c:898:
Int next = IntInit();
IntMul(&next, &acc, ¤t);
IntDeinit(&acc);
acc = next;- In
Int.c:1156:
IntGCD(&gcd, a, b);
IntDiv("ient, a, &gcd);
IntMul(&lcm, "ient, b);
IntDeinit(&gcd);- In
Int.c:1443:
IntMod(&ar, a, modulus);
IntMod(&br, b, modulus);
IntMul(&prod, &ar, &br);
IntMod(result, &prod, modulus);- In
Int.Math.c:208:
bool test_int_mul(void) {
WriteFmt("Testing IntMul\n");
Int a = IntFrom(21);- In
Int.Math.c:214:
Int result_value = IntInit();
IntMul(&result_value, &a, &b);
bool result = IntToU64(&result_value) == 126;- In
Int.Math.c:225:
bool test_int_mul_scalar(void) {
WriteFmt("Testing IntMul generic dispatch\n");
Int value = IntFromStr("12345678901234567890");- In
Int.Math.c:231:
Str text = StrInit();
IntMul(&result_value, &value, 25u);
text = IntToStr(&result_value);- In
Int.Math.c:243:
bool test_int_mul_zero(void) {
WriteFmt("Testing IntMul with zero\n");
Int a = IntFrom(0);- In
Int.Math.c:249:
Int result_value = IntInit();
IntMul(&result_value, &a, &b);
bool result = IntIsZero(&result_value);- In
Math.h:80:
/// TAGS: Int, Math, Multiply
///
void (IntMul)(Int *result, Int *a, Int *b);
///
/// Square an integer.
- In
Math.h:471:
(rhs), \
Int: MISRA_PRIV_IntMulValue, \
Int *: IntMul, \
const Int *: MISRA_PRIV_IntMulConst, \
unsigned char: MISRA_PRIV_IntMulU64, \
Last updated on