mirror of
https://github.com/Sunscreen-tech/Sunscreen.git
synced 2026-01-10 06:08:00 -05:00
Add PartialEq to everything (#395)
This commit is contained in:
@@ -24,13 +24,14 @@ macro_rules! dst {
|
||||
paste::paste! {
|
||||
|
||||
$(#[$meta])*
|
||||
#[derive($($derive,)*)]
|
||||
#[derive($($derive,)* PartialEq)]
|
||||
pub struct $t<T> where T: Clone $(+ $t_bounds)* {
|
||||
data: aligned_vec::AVec<$wrapper<T>, aligned_vec::ConstAlign<{ crate::scratch::SIMD_ALIGN }>>
|
||||
}
|
||||
|
||||
/// A reference to the data structure.
|
||||
#[repr(transparent)]
|
||||
#[derive(PartialEq)]
|
||||
pub struct $ref_t<T> where T: Clone $(+ $t_bounds)* {
|
||||
data: [$wrapper<T>],
|
||||
}
|
||||
|
||||
@@ -21,7 +21,7 @@ dst! {
|
||||
Polynomial,
|
||||
PolynomialRef,
|
||||
NoWrapper,
|
||||
(Debug, Clone, PartialEq, Eq, Serialize, Deserialize),
|
||||
(Debug, Clone, Serialize, Deserialize),
|
||||
()
|
||||
}
|
||||
dst_iter! { PolynomialIterator, PolynomialIteratorMut, ParallelPolynomialIterator, ParallelPolynomialIteratorMut, NoWrapper, PolynomialRef, () }
|
||||
@@ -375,12 +375,6 @@ where
|
||||
}
|
||||
}
|
||||
|
||||
impl<T: PartialEq + Clone> PartialEq for PolynomialRef<T> {
|
||||
fn eq(&self, other: &Self) -> bool {
|
||||
self.coeffs() == other.coeffs()
|
||||
}
|
||||
}
|
||||
|
||||
impl<T: std::fmt::Debug + Clone> std::fmt::Debug for PolynomialRef<T> {
|
||||
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
|
||||
f.debug_struct("PolynomialRef")
|
||||
@@ -398,7 +392,6 @@ mod tests {
|
||||
#[test]
|
||||
fn can_add_polynomials() {
|
||||
let a = Polynomial::new(&[1, 2, 3]);
|
||||
|
||||
let b = Polynomial::new(&[4, 5, 6]);
|
||||
|
||||
let expected = Polynomial::new(&[5, 7, 9]);
|
||||
|
||||
@@ -15,7 +15,7 @@ dst! {
|
||||
PolynomialFft,
|
||||
PolynomialFftRef,
|
||||
NoWrapper,
|
||||
(Debug, Clone, PartialEq, Eq,),
|
||||
(Debug, Clone),
|
||||
()
|
||||
}
|
||||
dst_iter!(
|
||||
|
||||
@@ -12,7 +12,7 @@ dst! {
|
||||
PolynomialList,
|
||||
PolynomialListRef,
|
||||
NoWrapper,
|
||||
(Debug, Clone, PartialEq, Eq,),
|
||||
(Debug, Clone),
|
||||
()
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user