MCPcopy Create free account
hub / github.com/WebAssembly/wabt / GetBytes

Method GetBytes

src/opcode.cc:435–448  ·  view source on GitHub ↗

Get the byte sequence for this opcode, including prefix.

Source from the content-addressed store, hash-verified

433
434// Get the byte sequence for this opcode, including prefix.
435std::vector<uint8_t> Opcode::GetBytes() const {
436 std::vector<uint8_t> result;
437 if (HasPrefix()) {
438 result.push_back(GetPrefix());
439 uint8_t buffer[5];
440 Offset length =
441 WriteU32Leb128Raw(buffer, buffer + sizeof(buffer), GetCode());
442 assert(length != 0);
443 result.insert(result.end(), buffer, buffer + length);
444 } else {
445 result.push_back(GetCode());
446 }
447 return result;
448}
449
450} // namespace wabt

Callers 2

TESTFunction · 0.80

Calls 4

WriteU32Leb128RawFunction · 0.85
insertMethod · 0.80
push_backMethod · 0.45
endMethod · 0.45

Tested by 1

TESTFunction · 0.64