From a50fbc1c74e1639a5bba71c2a7cdc9505706e1f5 Mon Sep 17 00:00:00 2001 From: Jean-Philippe Bossuat Date: Tue, 21 Jan 2025 13:56:39 +0100 Subject: [PATCH] added a_mul_b_montgomery_add_c_into_c --- math/src/ring/impl_u64/ring.rs | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/math/src/ring/impl_u64/ring.rs b/math/src/ring/impl_u64/ring.rs index 73667f7..b1e794d 100644 --- a/math/src/ring/impl_u64/ring.rs +++ b/math/src/ring/impl_u64/ring.rs @@ -223,6 +223,20 @@ impl Ring { .va_mul_vb_montgomery_into_vc::(&a.0, &b.0, &mut c.0); } + #[inline(always)] + pub fn a_mul_b_montgomery_add_c_into_c( + &self, + a: &Poly>, + b: &Poly, + c: &mut Poly, + ) { + debug_assert!(a.n() == self.n(), "a.n()={} != n={}", a.n(), self.n()); + debug_assert!(b.n() == self.n(), "b.n()={} != n={}", b.n(), self.n()); + debug_assert!(c.n() == self.n(), "c.n()={} != n={}", c.n(), self.n()); + self.modulus + .va_mul_vb_montgomery_add_vc_into_vc::(&a.0, &b.0, &mut c.0); + } + #[inline(always)] pub fn a_mul_b_montgomery_into_a( &self,