MCPcopy Create free account
hub / github.com/WasmVM/WasmVM / mem_span

Function mem_span

host/sysenv/sysenv.cpp:75–83  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

73}
74
75std::span<byte_t> mem_span(Stack& stack, i64_t ptr, i64_t len) {
76 MemInst& mem = get_mem(stack, ptr);
77 size_t off = (size_t)((uint64_t)ptr & PTR_OFF_MASK);
78 size_t end = off + (size_t)len;
79 if(end > mem.data.size()) {
80 throw std::out_of_range("sysenv: memory access out of bounds");
81 }
82 return std::span<byte_t>(mem.data.data() + off, (size_t)len);
83}
84
85std::string mem_string(Stack& stack, i64_t ptr, i64_t len) {
86 auto sp = mem_span(stack, ptr, len);

Callers 4

mem_stringFunction · 0.85
fs_readFunction · 0.85
fs_writeFunction · 0.85
fs_getcwdFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected