cursor write revert to memcpy
This commit is contained in:
parent
54af1c5fd3
commit
2d2ccee10d
@ -62,12 +62,8 @@ impl Write for Cursor<&mut [u8]> {
|
||||
fn write(&mut self, buf: &[u8]) -> Result<usize, IoError> {
|
||||
let data = &mut self.inner[self.pos..];
|
||||
let len = buf.len().min(data.len());
|
||||
for i in 0..len {
|
||||
unsafe {
|
||||
asm!("", options(preserves_flags, nostack, readonly));
|
||||
}
|
||||
data[i] = buf[i];
|
||||
}
|
||||
// as long as 'copy_work_buffer' is used in drtioaux, memcpy here is allowed
|
||||
data[..len].copy_from_slice(&buf[..len]);
|
||||
self.pos += len;
|
||||
Ok(len)
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user