Skip to content

Commit

Permalink
Added impl<Add> for Address64 (#56)
Browse files Browse the repository at this point in the history
This lets you use the `+` operator between `Address64` and `32bit` integers
  • Loading branch information
Jujstme authored Sep 23, 2023
1 parent 291c76e commit 5b20e24
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions src/primitives/address.rs
Original file line number Diff line number Diff line change
Expand Up @@ -158,3 +158,21 @@ impl Add<i8> for Address {
Self(self.0.wrapping_add_signed(bytes as _))
}
}

impl Add<i32> for Address64 {
type Output = Self;

#[inline]
fn add(self, bytes: i32) -> Self {
Self(self.0.wrapping_add(bytes as _))
}
}

impl Add<u32> for Address64 {
type Output = Self;

#[inline]
fn add(self, bytes: u32) -> Self {
Self(self.0.wrapping_add(bytes as _))
}
}

0 comments on commit 5b20e24

Please sign in to comment.