Merge pull request #166 from hbina/use_add_instead_of_offset
Use `add` instead of `offset` so we don't need to cast to isize.
This commit is contained in:
+3
-3
@@ -241,7 +241,7 @@ impl<A> ArrayString<A>
|
||||
return Err(CapacityError::new(s));
|
||||
}
|
||||
unsafe {
|
||||
let dst = self.xs.ptr_mut().offset(self.len() as isize);
|
||||
let dst = self.xs.ptr_mut().add(self.len());
|
||||
let src = s.as_ptr();
|
||||
ptr::copy_nonoverlapping(src, dst, s.len());
|
||||
let newl = self.len() + s.len();
|
||||
@@ -332,8 +332,8 @@ impl<A> ArrayString<A>
|
||||
let next = idx + ch.len_utf8();
|
||||
let len = self.len();
|
||||
unsafe {
|
||||
ptr::copy(self.xs.ptr().offset(next as isize),
|
||||
self.xs.ptr_mut().offset(idx as isize),
|
||||
ptr::copy(self.xs.ptr().add(next),
|
||||
self.xs.ptr_mut().add(idx),
|
||||
len - next);
|
||||
self.set_len(len - (next - idx));
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user