fast_posit/posit/
traits.rs1use super::*;
2
3impl<const N: u32, const ES: u32, const RS: u32, Int: crate::Int>
15Clone for Posit<N, ES, Int, RS> {
16 #[inline]
17 fn clone(&self) -> Self {
18 *self
19 }
20}
21
22impl<const N: u32, const ES: u32, const RS: u32, Int: crate::Int>
23Copy for Posit<N, ES, Int, RS> {}
24
25impl<const N: u32, const ES: u32, const RS: u32, Int: crate::Int>
39PartialEq for Posit<N, ES, Int, RS> {
40 #[inline]
41 fn eq(&self, other: &Self) -> bool {
42 self.0 == other.0
43 }
44}
45
46impl<const N: u32, const ES: u32, const RS: u32, Int: crate::Int>
47Eq for Posit<N, ES, Int, RS> {}
48
49impl<const N: u32, const ES: u32, const RS: u32, Int: crate::Int>
64PartialOrd for Posit<N, ES, Int, RS> {
65 #[inline]
66 fn partial_cmp(&self, other: &Self) -> Option<core::cmp::Ordering> {
67 Some(self.cmp(other))
68 }
69}
70
71impl<const N: u32, const ES: u32, const RS: u32, Int: crate::Int>
72Ord for Posit<N, ES, Int, RS> {
73 #[inline]
74 fn cmp(&self, other: &Self) -> core::cmp::Ordering {
75 self.0.cmp(&other.0)
76 }
77}
78
79impl<const N: u32, const ES: u32, const RS: u32, Int: crate::Int>
80core::hash::Hash for Posit<N, ES, Int, RS> {
81 #[inline]
82 fn hash<H: core::hash::Hasher>(&self, state: &mut H) {
83 self.0.hash(state);
84 }
85}
86
87impl<const N: u32, const ES: u32, const RS: u32, Int: crate::Int>
88Default for Posit<N, ES, Int, RS> {
89 #[inline]
90 fn default() -> Self {
91 Self(Default::default())
92 }
93}