-
Notifications
You must be signed in to change notification settings - Fork 13.8k
Make use of [wrapping_]byte_{add,sub}
#100819
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change | ||||
---|---|---|---|---|---|---|
|
@@ -64,7 +64,7 @@ macro_rules! iterator { | |||||
// backwards by `n`. `n` must not exceed `self.len()`. | ||||||
macro_rules! zst_shrink { | ||||||
($self: ident, $n: ident) => { | ||||||
$self.end = ($self.end as * $raw_mut u8).wrapping_offset(-$n) as * $raw_mut T; | ||||||
$self.end = $self.end.wrapping_byte_offset(-$n); | ||||||
|
$self.end = $self.end.wrapping_byte_offset(-$n); | |
$self.end = $self.end.wrapping_byte_sub($n); |
since it's explicitly shrink
.
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.
I haven't done this originally because ($n): isize
, but I've just checked and it seems that this is only called with literals and smt as isize
so this change makes sense.
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.
Is this right? It's using
self.ptr
instead ofself.end
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.
Indeed this is wrong; should be fixed by #101237.
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.
I'm sorry 🥲