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

Function byteswap

packages/polygen/cpp/ReactNativePolygen/w2c.cpp:16–23  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

14
15template<std::integral T>
16constexpr T byteswap(T value) noexcept
17{
18 static_assert(std::has_unique_object_representations_v<T>,
19 "T may not have padding bits");
20 auto value_representation = std::bit_cast<std::array<std::byte, sizeof(T)>>(value);
21 std::ranges::reverse(value_representation);
22 return std::bit_cast<T>(value_representation);
23}
24
25ModuleMetadataView* ModuleMetadataView::fromBuffer(std::span<uint8_t> moduleData) {
26 assert(moduleData.size() >= sizeof(ModuleMetadataView));

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected