From 879868cc290ae1a626bf0cb4957026057898ae17 Mon Sep 17 00:00:00 2001 From: numbers Date: Thu, 8 Feb 2024 20:14:52 -0500 Subject: [PATCH] util operators --- src/win32/pe_image.rs | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/src/win32/pe_image.rs b/src/win32/pe_image.rs index 048bbe8..1cffc5a 100644 --- a/src/win32/pe_image.rs +++ b/src/win32/pe_image.rs @@ -2,7 +2,7 @@ // PE stuff // ============================== -use core::ops::Range; +use core::ops::{Add, Range, Sub}; use crate::upcast::Upcast; #[repr(C)] @@ -286,3 +286,18 @@ impl<'a> Iterator for ExportIter<'a> { } } } + + +impl Add for &ImageBase { + type Output = usize; + fn add(self, rhs: usize) -> Self::Output { + (self as *const _ as usize) + rhs + } +} + +impl Sub for &ImageBase { + type Output = usize; + fn sub(self, rhs: usize) -> Self::Output { + (self as *const _ as usize) + rhs + } +}