Skip to content

IntGCD

Usage example (Cross-references)

Usage examples (Cross-references)
    }
    
    bool IntGCD(Int *result, const Int *a, const Int *b) {
        ValidateInt(result);
        ValidateInt(a);
        Int lcm      = IntInit(IntAllocator(result));
    
        if (!IntGCD(&gcd, a, b) || !int_div(&quotient, a, &gcd) || !int_mul(&lcm, &quotient, b)) {
            IntDeinit(&gcd);
            IntDeinit(&quotient);
    
    bool test_int_gcd(void) {
        WriteFmt("Testing IntGCD\n");
    
        DefaultAllocator alloc = DefaultAllocatorInit();
        Int result_value = IntInit(&alloc.base);
    
        IntGCD(&result_value, &a, &b);
    
        bool result = IntToU64(&result_value) == 6;
Last updated on