Skip to content
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

Remove extraneous branch from push #241

Merged
merged 1 commit into from Nov 30, 2020
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
12 changes: 7 additions & 5 deletions src/lib.rs
Expand Up @@ -753,13 +753,15 @@ impl<A: Array> SmallVec<A> {
#[inline]
pub fn push(&mut self, value: A::Item) {
unsafe {
let (_, &mut len, cap) = self.triple_mut();
if len == cap {
let (mut ptr, mut len, cap) = self.triple_mut();
if *len == cap {
self.reserve(1);
let &mut (heap_ptr, ref mut heap_len) = self.data.heap_mut();
ptr = heap_ptr;
len = heap_len;
}
let (ptr, len_ptr, _) = self.triple_mut();
*len_ptr = len + 1;
ptr::write(ptr.add(len), value);
ptr::write(ptr.add(*len), value);
*len += 1;
}
}

Expand Down