derive some traits to be able to compare addresses
This commit is contained in:
parent
9b2e7b8837
commit
784544ae2b
@ -1,6 +1,6 @@
|
|||||||
use std::fmt;
|
use std::fmt;
|
||||||
|
|
||||||
#[derive(Copy,Clone,Debug)]
|
#[derive(Copy,Clone,Debug,Ord,PartialOrd,Eq,PartialEq)]
|
||||||
pub struct AddressRange {
|
pub struct AddressRange {
|
||||||
start: u64, // inclusive
|
start: u64, // inclusive
|
||||||
end: u64, // exclusive
|
end: u64, // exclusive
|
||||||
@ -66,6 +66,8 @@ impl AddressRange {
|
|||||||
|
|
||||||
pub fn base(&self) -> u64 { self.start }
|
pub fn base(&self) -> u64 { self.start }
|
||||||
|
|
||||||
|
pub fn end(&self) -> u64 { self.end }
|
||||||
|
|
||||||
pub fn size(&self) -> usize { (self.end - self.start) as usize }
|
pub fn size(&self) -> usize { (self.end - self.start) as usize }
|
||||||
|
|
||||||
pub fn is_base2_sized(&self) -> bool {
|
pub fn is_base2_sized(&self) -> bool {
|
||||||
|
Loading…
Reference in New Issue
Block a user