MCPcopy Create free account
hub / github.com/WasmEdge/WasmEdge / getBytes

Method getBytes

include/runtime/instance/memory.h:145–154  ·  view source on GitHub ↗

Get slice of Data[Offset : Offset + Length - 1]

Source from the content-addressed store, hash-verified

143
144 /// Get slice of Data[Offset : Offset + Length - 1]
145 Expect<Span<Byte>> getBytes(const uint64_t Offset,
146 const uint64_t Length) const noexcept {
147 // Check the memory boundary.
148 if (unlikely(!checkAccessBound(Offset, Length))) {
149 spdlog::error(ErrCode::Value::MemoryOutOfBounds);
150 spdlog::error(ErrInfo::InfoBoundary(Offset, Length, getSize()));
151 return Unexpect(ErrCode::Value::MemoryOutOfBounds);
152 }
153 return Span<Byte>(&DataPtr[Offset], Length);
154 }
155
156 /// Replace the bytes of Data[Offset :] by Slice[Start : Start + Length - 1]
157 Expect<void> setBytes(Span<const Byte> Slice, const uint64_t Offset,

Callers 4

runMemoryCopyOpMethod · 0.80
TESTFunction · 0.80
read_c_strFunction · 0.80

Calls 4

unlikelyFunction · 0.85
InfoBoundaryClass · 0.85
UnexpectFunction · 0.85
errorFunction · 0.50

Tested by

no test coverage detected