Skip to content

Avoid using the std::intrinsics module #20

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

Merged
merged 1 commit into from
Sep 18, 2015
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions src/tendril.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.

use std::{ptr, mem, intrinsics, hash, str, u32, io, slice, cmp};
use std::{ptr, mem, hash, str, u32, io, slice, cmp};
use std::sync::atomic::{self, AtomicUsize};
use std::sync::atomic::Ordering as AtomicOrdering;
use std::borrow::{Borrow, Cow};
Expand Down Expand Up @@ -1013,7 +1013,7 @@ impl<F, A> Tendril<F, A>
marker: PhantomData,
refcount_marker: PhantomData,
};
intrinsics::copy_nonoverlapping(x.as_ptr(), &mut t.len as *mut u32 as *mut u8, len);
ptr::copy_nonoverlapping(x.as_ptr(), &mut t.len as *mut u32 as *mut u8, len);
t
}

Expand All @@ -1032,7 +1032,7 @@ impl<F, A> Tendril<F, A>
unsafe fn owned_copy(x: &[u8]) -> Tendril<F, A> {
let len32 = x.len() as u32;
let mut b = Buf32::with_capacity(len32, Header::new());
intrinsics::copy_nonoverlapping(x.as_ptr(), b.data_ptr(), x.len());
ptr::copy_nonoverlapping(x.as_ptr(), b.data_ptr(), x.len());
b.len = len32;
Tendril::owned(b)
}
Expand Down
4 changes: 2 additions & 2 deletions src/util.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.

use std::{slice, intrinsics};
use std::{slice, ptr};
use std::mem;

#[inline(always)]
Expand All @@ -23,7 +23,7 @@ pub unsafe fn unsafe_slice_mut<'a>(buf: &'a mut [u8], start: usize, new_len: usi

#[inline(always)]
pub unsafe fn copy_and_advance(dest: &mut *mut u8, src: &[u8]) {
intrinsics::copy_nonoverlapping(src.as_ptr(), *dest, src.len());
ptr::copy_nonoverlapping(src.as_ptr(), *dest, src.len());
*dest = dest.offset(src.len() as isize)
}

Expand Down