diff --git a/src/allocator.rs b/src/allocator.rs index 75fe65c4..f0526db5 100644 --- a/src/allocator.rs +++ b/src/allocator.rs @@ -2,6 +2,8 @@ use crate::err_utils::err; use crate::number::{node_from_number, number_from_u8, Number}; use crate::reduction::EvalErr; use chia_bls::{G1Element, G2Element}; +use std::hash::Hash; +use std::hash::Hasher; const MAX_NUM_ATOMS: usize = 62500000; const MAX_NUM_PAIRS: usize = 62500000; @@ -101,12 +103,18 @@ pub enum NodeVisitor<'a> { Pair(NodePtr, NodePtr), } -#[derive(Debug, Clone, Copy)] +#[derive(Debug, Clone, Copy, Eq)] pub enum Atom<'a> { Borrowed(&'a [u8]), U32([u8; 4], usize), } +impl Hash for Atom<'_> { + fn hash(&self, state: &mut H) { + self.as_ref().hash(state) + } +} + impl PartialEq for Atom<'_> { fn eq(&self, other: &Atom) -> bool { self.as_ref().eq(other.as_ref())