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

Function ExternSTLSetInsert

test/externref/ExternrefTest.cpp:245–252  ·  view source on GitHub ↗

Host function to insert a key into std::set .

Source from the content-addressed store, hash-verified

243
244// Host function to insert a key into std::set<uint32_t>.
245WasmEdge_Result ExternSTLSetInsert(void *, const WasmEdge_CallingFrameContext *,
246 const WasmEdge_Value *In, WasmEdge_Value *) {
247 // Function type: {externref, i32} -> {}
248 void *Ptr = WasmEdge_ValueGetExternRef(In[0]);
249 auto &Set = *reinterpret_cast<std::set<uint32_t> *>(Ptr);
250 Set.insert(static_cast<uint32_t>(WasmEdge_ValueGetI32(In[1])));
251 return WasmEdge_Result_Success;
252}
253
254// Host function to erase std::set<uint32_t> by key.
255WasmEdge_Result ExternSTLSetErase(void *, const WasmEdge_CallingFrameContext *,

Callers

nothing calls this directly

Calls 3

WasmEdge_ValueGetI32Function · 0.85
insertMethod · 0.80

Tested by

no test coverage detected