use super::{
modulo::{Modulo, ModuloRepr},
modulo_ring::{ModuloRing, ModuloRingDouble, ModuloRingLarge, ModuloRingSingle},
};
use crate::error::panic_different_rings;
use core::ptr;
impl PartialEq for ModuloRing {
#[inline]
fn eq(&self, other: &Self) -> bool {
ptr::eq(self, other)
}
}
impl Eq for ModuloRing {}
impl PartialEq for ModuloRingSingle {
#[inline]
fn eq(&self, other: &Self) -> bool {
ptr::eq(self, other)
}
}
impl Eq for ModuloRingSingle {}
impl PartialEq for ModuloRingDouble {
#[inline]
fn eq(&self, other: &Self) -> bool {
ptr::eq(self, other)
}
}
impl Eq for ModuloRingDouble {}
impl PartialEq for ModuloRingLarge {
#[inline]
fn eq(&self, other: &Self) -> bool {
ptr::eq(self, other)
}
}
impl Eq for ModuloRingLarge {}
impl PartialEq for Modulo<'_> {
#[inline]
fn eq(&self, other: &Self) -> bool {
match (self.repr(), other.repr()) {
(ModuloRepr::Single(raw0, ring0), ModuloRepr::Single(raw1, ring1)) => {
Modulo::check_same_ring_single(ring0, ring1);
raw0.eq(raw1)
}
(ModuloRepr::Double(raw0, ring0), ModuloRepr::Double(raw1, ring1)) => {
Modulo::check_same_ring_double(ring0, ring1);
raw0.eq(raw1)
}
(ModuloRepr::Large(raw0, ring0), ModuloRepr::Large(raw1, ring1)) => {
Modulo::check_same_ring_large(ring0, ring1);
raw0.eq(raw1)
}
_ => panic_different_rings(),
}
}
}
impl Eq for Modulo<'_> {}