util operators

This commit is contained in:
numbers
2024-02-08 20:14:52 -05:00
parent 760e36bdb1
commit 879868cc29

View File

@@ -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<usize> for &ImageBase {
type Output = usize;
fn add(self, rhs: usize) -> Self::Output {
(self as *const _ as usize) + rhs
}
}
impl Sub<usize> for &ImageBase {
type Output = usize;
fn sub(self, rhs: usize) -> Self::Output {
(self as *const _ as usize) + rhs
}
}