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

Method read_32

crates/tinywasm/src/store/memory/mod.rs:182–190  ·  view source on GitHub ↗

Reads exactly 4 bytes at the effective address `base + offset`.

(&self, base: u64, offset: u64)

Source from the content-addressed store, hash-verified

180
181 /// Reads exactly 4 bytes at the effective address `base + offset`.
182 fn read_32(&self, base: u64, offset: u64) -> core::result::Result<[u8; 4], crate::Trap> {
183 let addr = checked_effective_addr::<4>(self.len(), base, offset)?;
184 let mut bytes = [0; 4];
185 self.read_exact(addr, &mut bytes).ok_or_else(|| {
186 cold_path();
187 memory_oob(addr, 4, self.len())
188 })?;
189 Ok(bytes)
190 }
191
192 /// Reads exactly 8 bytes at the effective address `base + offset`.
193 fn read_64(&self, base: u64, offset: u64) -> core::result::Result<[u8; 8], crate::Trap> {

Callers

nothing calls this directly

Implementers 3

vec.rscrates/tinywasm/src/store/memory/vec.r
paged.rscrates/tinywasm/src/store/memory/paged
lazy.rscrates/tinywasm/src/store/memory/lazy.

Calls 3

memory_oobFunction · 0.85
lenMethod · 0.45
read_exactMethod · 0.45

Tested by

no test coverage detected