-
Notifications
You must be signed in to change notification settings - Fork 4
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Enhanced MemoryAddr
#4
Conversation
But I think |
Yes, I think so. But having |
I just read your do as donot by mistake, yep, they all LGTM |
memory_addr/src/range.rs
Outdated
@@ -98,7 +92,11 @@ where | |||
/// ``` | |||
#[inline] | |||
pub fn size(self) -> usize { | |||
usize!(self.end) - usize!(self.start) | |||
if self.is_empty() { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why is there an if
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
To handle empty ranges with start > end
. I think we should make it clear what it means and what the behavior these methods should have when start > end
. Maybe just reject them with a checked new
and write a new_unchecked
?
…tailed unit tests
I think this and #3 are mergeable as the behavior of the structures and functions has been clarified by docs and tested by doc and unit tests now. @hky1999 @equation314 |
* use local `memory_addr` for `memory_set`, update `memory_set`, move generic params of mapping structures into `MappingBackEnd` as associated types * fix docs * Enhanced `MemoryAddr` (#4) * demo: what if we add more bounds to `MemoryAddr` * remove arithmetic bounds for `MemoryAddr`, add some provided methods * rename `MemoryAddr::sub_addr` to `MemoryAddr::offset_from` * remove a wrong bug todo * add two more functions to `VirtAddr` * add `add` and `sub` to `MemoryAddr` * clarify the behavior of arithmetic operations of `MemoryAddr`, add detailed unit tests * formatted * add `overflowing_add/sub` to `MemoryAddr` * add `checked_add/sub` to `MemoryAddr` * `AddrRange` candidate B: allow malformed ranges and treat them as empty * doc and tests improvement for `MemoryAddr` and `AddrRange` * update `PageIter` * formatted * even more tests, ready to merge * switch to `AddrRange` candidate A * add `sub_addr` series to `MemoryAddr`, improve panic messages in `MemoryAddr` and `AddrRange` * some small code improvements * bump version to 0.3.0 * update function calls about address arithmetic operations in `MemoryArea`s and `MemorySet`s * loosen memory area shrink check
This is what we can get if we add more bounds to
MemoryAddr
. I do think it's worth it.