MCPcopy Create free account
hub / github.com/callstackincubator/polygen / fromBuffer

Method fromBuffer

packages/polygen/cpp/ReactNativePolygen/w2c.cpp:25–33  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

23}
24
25ModuleMetadataView* ModuleMetadataView::fromBuffer(std::span<uint8_t> moduleData) {
26 assert(moduleData.size() >= sizeof(ModuleMetadataView));
27 auto* view = ((ModuleMetadataView*)moduleData.data());
28
29 if constexpr (std::endian::native == std::endian::big) {
30 view->nameLength = byteswap<uint16_t>(view->nameLength);
31 }
32 return view;
33}
34
35bool ModuleMetadataView::isMetadata(std::span<uint8_t> moduleData) {
36 return moduleData.size() >= 6 && memcmp(moduleData.data(), MAGIC_NUMBER, 6) == 0;

Callers

nothing calls this directly

Calls 2

sizeMethod · 0.80
dataMethod · 0.80

Tested by

no test coverage detected