mirror of
https://github.com/simonask/libyaml-safer
synced 2024-11-27 05:40:20 +00:00
Eliminate integer-to-pointer cast in offset implementation
This commit is contained in:
parent
9951855ff3
commit
6a9ed3ee68
1 changed files with 2 additions and 2 deletions
|
@ -192,7 +192,7 @@ trait PointerExt: Sized {
|
|||
|
||||
impl<T> PointerExt for *const T {
|
||||
fn c_offset(self, count: isize) -> *const T {
|
||||
(self as isize + count * size_of::<T>() as isize) as *const T
|
||||
self.wrapping_offset(count)
|
||||
}
|
||||
|
||||
fn c_offset_from(self, origin: *const T) -> isize {
|
||||
|
@ -202,7 +202,7 @@ impl<T> PointerExt for *const T {
|
|||
|
||||
impl<T> PointerExt for *mut T {
|
||||
fn c_offset(self, count: isize) -> *mut T {
|
||||
(self as isize + count * size_of::<T>() as isize) as *mut T
|
||||
self.wrapping_offset(count)
|
||||
}
|
||||
|
||||
fn c_offset_from(self, origin: *mut T) -> isize {
|
||||
|
|
Loading…
Reference in a new issue