1#[derive(Copy, Clone)]
3pub struct VirtualAddressOffset(pub i128);
4
5impl VirtualAddressOffset {
6 pub fn zero() -> Self {
7 return VirtualAddressOffset::new(0);
8 }
9
10 pub fn new(offset: i128) -> Self {
11 return VirtualAddressOffset(offset);
12 }
13
14 pub fn Offset(&self) -> i128 {
15 return self.0;
16 }
17}
18
19impl core::ops::Add<u64> for VirtualAddressOffset {
20 type Output = u64;
21
22 fn add(self, offset: u64) -> Self::Output {
23 return u64::try_from(self.0.checked_add(i128::from(offset)).unwrap()).unwrap();
24 }
25}