1use super::{ConstCoeffBitWidth, EvaluatablePolynomial, EvaluationError};
2use crate::Polynomial;
3use crypto_primitives::crypto_bigint_int::Int;
4use zinc_transcript::traits::ConstTranscribable;
5
6macro_rules! impl_zero_degree {
7 ($($t:ty),+) => {
8 $(
9 impl Polynomial<Self> for $t {
10 const DEGREE_BOUND: usize = 0;
11 }
12
13 impl EvaluatablePolynomial<Self, Self> for $t {
14 type EvaluationPoint = Self;
15
16 fn evaluate_at_point(&self, _point: &Self) -> Result<Self, EvaluationError> {
17 Ok(self.clone())
18 }
19 }
20
21 impl ConstCoeffBitWidth for $t {
22 const COEFF_BIT_WIDTH: usize = <$t>::BITS as usize;
23 }
24 )*
25 };
26}
27
28impl_zero_degree!(i8, i16, i32, i64, i128);
29impl_zero_degree!(u8, u16, u32, u64, u128);
30
31impl<const LIMBS: usize> Polynomial<Self> for Int<LIMBS> {
32 const DEGREE_BOUND: usize = 0;
33}
34
35impl<const LIMBS: usize> EvaluatablePolynomial<Self, Self> for Int<LIMBS> {
36 type EvaluationPoint = Self;
37
38 fn evaluate_at_point(&self, _point: &Self) -> Result<Self, EvaluationError> {
39 Ok(*self)
40 }
41}
42
43impl<const LIMBS: usize> ConstCoeffBitWidth for Int<LIMBS> {
44 const COEFF_BIT_WIDTH: usize = Self::NUM_BITS;
45}