binius_field/arch/portable/
reuse_multiply_arithmetic.rs1use std::ops::Mul;
4
5use crate::{
6 arch::ReuseMultiplyStrategy,
7 arithmetic_traits::{TaggedMulAlpha, TaggedSquare},
8};
9
10impl<T> TaggedSquare<ReuseMultiplyStrategy> for T
11where
12 T: Mul<Self, Output = Self> + Copy,
13{
14 fn square(self) -> Self {
15 self * self
16 }
17}
18
19pub trait Alpha {
20 fn alpha() -> Self;
21}
22
23impl<T> TaggedMulAlpha<ReuseMultiplyStrategy> for T
24where
25 T: Mul<Self, Output = Self> + Alpha,
26{
27 #[inline]
28 fn mul_alpha(self) -> Self {
29 self * Self::alpha()
30 }
31}