MCPcopy Create free account
hub / github.com/PlotJuggler/PlotJuggler / readIndex

Function readIndex

pj_datastore/src/encoding.cpp:37–55  ·  view source on GitHub ↗

Read an index at the given byte width

Source from the content-addressed store, hash-verified

35
36// Read an index at the given byte width
37[[nodiscard]] uint32_t readIndex(const uint8_t* data, std::size_t row, uint8_t bytes) {
38 switch (bytes) {
39 case 1: {
40 uint8_t v = 0;
41 std::memcpy(&v, data + row, sizeof(v));
42 return v;
43 }
44 case 2: {
45 uint16_t v = 0;
46 std::memcpy(&v, data + row * 2, sizeof(v));
47 return v;
48 }
49 default: {
50 uint32_t v = 0;
51 std::memcpy(&v, data + row * 4, sizeof(v));
52 return v;
53 }
54 }
55}
56
57} // namespace
58

Callers 1

dictionaryLookupFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected