IntGCD
Usage example (Cross-references)
Usage examples (Cross-references)
- In
Int.c:1931:
}
bool IntGCD(Int *result, const Int *a, const Int *b) {
ValidateInt(result);
ValidateInt(a);- In
Int.c:1979:
Int lcm = IntInit(IntAllocator(result));
if (!IntGCD(&gcd, a, b) || !int_div("ient, a, &gcd) || !int_mul(&lcm, "ient, b)) {
IntDeinit(&gcd);
IntDeinit("ient);- In
Math.c:487:
bool test_int_gcd(void) {
WriteFmt("Testing IntGCD\n");
DefaultAllocator alloc = DefaultAllocatorInit();- In
Math.c:495:
Int result_value = IntInit(&alloc.base);
IntGCD(&result_value, &a, &b);
bool result = IntToU64(&result_value) == 6;- In
Math.c:1636:
// different, distinguishable outcome.
bool test_m13_gcd_null_result(void) {
WriteFmt("Testing IntGCD NULL result handling\n");
DefaultAllocator alloc = DefaultAllocatorInit();- In
Math.c:1643:
Int b = IntFrom(8, &alloc.base);
IntGCD(NULL, &a, &b);
IntDeinit(&a);- In
Math.c:1660:
// caller-observable.
bool test_m13_gcd_null_a(void) {
WriteFmt("Testing IntGCD NULL a handling\n");
DefaultAllocator alloc = DefaultAllocatorInit();- In
Math.c:1667:
Int result = IntInit(&alloc.base);
IntGCD(&result, NULL, &b);
IntDeinit(&b);- In
Math.c:1681:
// LOG_FATAL abort.
bool test_m13_gcd_null_b(void) {
WriteFmt("Testing IntGCD NULL b handling\n");
DefaultAllocator alloc = DefaultAllocatorInit();- In
Math.c:1688:
Int result = IntInit(&alloc.base);
IntGCD(&result, &a, NULL);
IntDeinit(&a);- In
Math.c:3994:
Int r = IntFrom(7u, a);
bool ok = IntGCD(&r, &x, &y);
ok = ok && IntToU64(&r) == 6u;
Last updated on