Skip to content

Avoid using the std::intrinsics module #803

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
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
8 changes: 4 additions & 4 deletions src/core/src/device/draw.rs
Original file line number Diff line number Diff line change
Expand Up @@ -55,13 +55,13 @@ impl DataBuffer {
/// Copy a given structure into the buffer, return the offset and the size.
#[cfg(not(unstable))]
pub fn add_struct<T: Copy>(&mut self, v: &T) -> DataPointer {
use std::{intrinsics, mem};
use std::{ptr, mem};
let offset = self.buf.len();
let size = mem::size_of::<T>();
self.buf.reserve(size);
unsafe {
self.buf.set_len(offset + size);
intrinsics::copy((v as *const T) as *const u8,
ptr::copy((v as *const T) as *const u8,
&mut self.buf[offset] as *mut u8,
size);
};
Expand All @@ -70,13 +70,13 @@ impl DataBuffer {

/// Copy a given vector slice into the buffer
pub fn add_vec<T: Copy>(&mut self, v: &[T]) -> DataPointer {
use std::{intrinsics, mem};
use std::{ptr, mem};
let offset = self.buf.len();
let size = mem::size_of::<T>() * v.len();
self.buf.reserve(size);
unsafe {
self.buf.set_len(offset + size);
intrinsics::copy(v.as_ptr() as *const u8,
ptr::copy(v.as_ptr() as *const u8,
&mut self.buf[offset] as *mut u8,
size);
}
Expand Down