1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
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<'_> {}