IntModInv
Usage example (Cross-references)
Usage examples (Cross-references)
- In
Int.c:2484:
bool ok = false;
ok = IntModInv(&inverse, b, modulus);
if (!ok) {
IntDeinit(&inverse);- In
Int.c:2630:
}
bool IntModInv(Int *result, const Int *value, const Int *modulus) {
ValidateInt(result);
ValidateInt(value);- In
Math.c:817:
bool test_int_mod_inv(void) {
WriteFmt("Testing IntModInv\n");
DefaultAllocator alloc = DefaultAllocatorInit();- In
Math.c:826:
Int check = IntInit(&alloc.base);
bool result = IntModInv(&result_value, &value, &mod);
result = result && (IntToU64(&result_value) == 4);- In
Math.c:920:
bool test_int_mod_inv_no_solution(void) {
WriteFmt("Testing IntModInv no-solution case\n");
DefaultAllocator alloc = DefaultAllocatorInit();- In
Math.c:928:
Int result_value = IntFrom(99, &alloc.base);
bool result = !IntModInv(&result_value, &value, &mod);
result = result && (IntToU64(&result_value) == 99);- In
Math.c:2704:
*/
bool test_m3_mod_inv_success_sets_ok(void) {
WriteFmt("Testing IntModInv returns true on a valid inverse\n");
DefaultAllocator alloc = DefaultAllocatorInit();- In
Math.c:2713:
Int check = IntInit(&alloc.base);
bool ok = IntModInv(&result, &value, &mod);
/* Real code: ok == true. Mutant flipping `ok = true`: ok == false. */- In
Math.c:2738:
*/
bool test_m3_mod_inv_negative_t_branch(void) {
WriteFmt("Testing IntModInv negative-coefficient normalization returns true\n");
DefaultAllocator alloc = DefaultAllocatorInit();- In
Math.c:2747:
Int check = IntInit(&alloc.base);
bool ok = IntModInv(&result, &value, &mod);
bool pass = ok;- In
Math.c:4354:
Int r = IntFrom(7u, a);
bool ok = IntModInv(&r, &v, &m);
ok = ok && (IntToU64(&r) * 17u) % 3120u == 1u;- In
Math.c:4376:
Int r = IntFrom(9u, a);
bool ok = IntModInv(&r, &v, &m);
ok = ok && IntToU64(&r) == 5u;- In
Math.c:4398:
Int r = IntFrom(7u, a);
bool ok = !IntModInv(&r, &v, &m); // returns false
IntDeinit(&v);- In
Math.c:4732:
Int inverse = IntFrom(0u, alloc);
bool ok = IntModInv(&inverse, &value, &modulus);
ok = ok && IntCompare(&inverse, 23u) == 0;
Last updated on