feat(big): add MulMod

This commit is contained in:
fallenoak 2023-02-04 14:46:03 -06:00
parent a597e8f495
commit 8bdbe3c653
No known key found for this signature in database
GPG key ID: 7628F8E61AEA070D
3 changed files with 74 additions and 0 deletions

View file

@ -231,6 +231,16 @@ void Mul(BigBuffer& a, const BigBuffer& b, const BigBuffer& c, BigStack& stack)
stack.UnmakeDistinct(a, aa);
}
void MulMod(BigBuffer& a, const BigBuffer& b, const BigBuffer& c, const BigBuffer& d, BigStack& stack) {
uint32_t allocCount = 0;
auto& scratch = stack.Alloc(&allocCount);
Mul(scratch, b, c, stack);
Div(scratch, a, scratch, d, stack);
stack.Free(allocCount);
}
void SetOne(BigBuffer& buffer) {
buffer.SetCount(1);
buffer[0] = 1;