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);Success
Returns true; *result holds a * b.
Failure
Returns false if an intermediate allocation fails; *result is unchanged.
Usage example (Cross-references)
Usage examples (Cross-references)
- In
Int.Math.c:230:
bool test_int_mul(void) {
WriteFmt("Testing IntMul\n");
DefaultAllocator alloc = DefaultAllocatorInit();- In
Int.Math.c:238:
Int result_value = IntInit(&alloc.base);
IntMul(&result_value, &a, &b);
bool result = IntToU64(&result_value) == 126;- In
Int.Math.c:250:
bool test_int_mul_scalar(void) {
WriteFmt("Testing IntMul generic dispatch\n");
DefaultAllocator alloc = DefaultAllocatorInit();- In
Int.Math.c:258:
Str text = StrInit(&alloc.base);
IntMul(&result_value, &value, 25u);
text = IntToStr(&result_value);- In
Int.Math.c:271:
bool test_int_mul_zero(void) {
WriteFmt("Testing IntMul with zero\n");
DefaultAllocator alloc = DefaultAllocatorInit();- In
Int.Math.c:279:
Int result_value = IntInit(&alloc.base);
IntMul(&result_value, &a, &b);
bool result = IntIsZero(&result_value);
Last updated on