cursor write revert to memcpy

This commit is contained in:
Simon Renblad 2025-01-22 14:28:35 +08:00
parent 54af1c5fd3
commit 2d2ccee10d

View File

@ -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)
}