MCPcopy Create free account
hub / github.com/comaps/comaps / Encode

Method Encode

libs/coding/elias_coder.hpp:16–28  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

14public:
15 template <typename TWriter>
16 static bool Encode(BitWriter<TWriter> & writer, uint64_t value)
17 {
18 if (value == 0)
19 return false;
20
21 uint8_t const n = bits::FloorLog(value);
22 ASSERT_LESS_OR_EQUAL(n, 63, ());
23
24 uint64_t const msb = static_cast<uint64_t>(1) << n;
25 writer.WriteAtMost64Bits(msb, n + 1);
26 writer.WriteAtMost64Bits(value, n);
27 return true;
28 }
29
30 template <typename TReader>
31 static uint64_t Decode(BitReader<TReader> & reader)

Callers

nothing calls this directly

Calls 2

FloorLogFunction · 0.85
WriteAtMost64BitsMethod · 0.80

Tested by

no test coverage detected