MCPcopy Create free account
hub / github.com/explodingcamera/tinywasm / write_128

Method write_128

crates/tinywasm/src/store/memory/paged.rs:411–424  ·  view source on GitHub ↗
(&mut self, base: u64, offset: u64, bytes: [u8; 16])

Source from the content-addressed store, hash-verified

409
410 #[inline(always)]
411 fn write_128(&mut self, base: u64, offset: u64, bytes: [u8; 16]) -> core::result::Result<(), crate::Trap> {
412 let addr = checked_effective_addr::<16>(self.len, base, offset)?;
413 let chunk_idx = addr >> self.chunk_shift;
414 let chunk_offset = addr & self.chunk_mask;
415 if chunk_offset + 16 <= self.chunk_size {
416 self.chunk_mut(chunk_idx)?[chunk_offset..chunk_offset + 16].copy_from_slice(&bytes);
417 } else {
418 if self.write_all(addr, &bytes).is_none() {
419 cold_path();
420 return Err(crate::Trap::OutOfMemory);
421 }
422 }
423 Ok(())
424 }
425}
426
427#[cfg(test)]

Callers

nothing calls this directly

Calls 3

chunk_mutMethod · 0.80
copy_from_sliceMethod · 0.45
write_allMethod · 0.45

Tested by

no test coverage detected