From 31c8eb2c5a298797422b467d060d575af0ca77d1 Mon Sep 17 00:00:00 2001 From: mason <35282038+emesare@users.noreply.github.com> Date: Wed, 20 Mar 2024 18:42:22 +0000 Subject: Implement Hash, PartialEq & Eq for riscv Register --- arch/riscv/src/lib.rs | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/arch/riscv/src/lib.rs b/arch/riscv/src/lib.rs index 6b3451a9..dbc4ed78 100644 --- a/arch/riscv/src/lib.rs +++ b/arch/riscv/src/lib.rs @@ -6,6 +6,7 @@ use std::borrow::Cow; use std::fmt; +use std::hash::Hash; use std::marker::PhantomData; use binaryninja::relocation::{Relocation, RelocationHandlerExt}; @@ -247,6 +248,20 @@ impl<'a, D: 'static + RiscVDisassembler + Send + Sync> LiftableWithSize<'a, Risc } } +impl Hash for Register { + fn hash(&self, state: &mut H) { + self.id.hash(state); + } +} + +impl PartialEq for Register { + fn eq(&self, other: &Self) -> bool { + self.id == other.id + } +} + +impl Eq for Register {} + impl fmt::Debug for Register { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { f.write_str(self.name().as_ref()) -- cgit v1.3.1