MCPcopy Create free account
hub / github.com/catboost/catboost / ReadVarUInt64

Function ReadVarUInt64

library/cpp/yson/varint.cpp:35–53  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

33 }
34
35 int ReadVarUInt64(IInputStream* input, ui64* value) {
36 size_t count = 0;
37 ui64 result = 0;
38
39 ui8 byte = 0;
40 do {
41 if (7 * count > 8 * sizeof(ui64)) {
42 ythrow yexception() << "The data is too long to read ui64";
43 }
44 if (input->Read(&byte, 1) != 1) {
45 ythrow yexception() << "The data is too short to read ui64";
46 }
47 result |= (static_cast<ui64>(byte & 0x7F)) << (7 * count);
48 ++count;
49 } while (byte & 0x80);
50
51 *value = result;
52 return count;
53 }
54
55 int ReadVarInt32(IInputStream* input, i32* value) {
56 ui64 varInt;

Callers 2

ReadVarInt32Function · 0.85
ReadVarInt64Function · 0.85

Calls 1

ReadMethod · 0.45

Tested by

no test coverage detected