MCPcopy Create free account
hub / github.com/defold/defold / DecodeMSB

Function DecodeMSB

engine/script/src/script_table.cpp:119–143  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

117 }
118
119 static bool DecodeMSB(uint32_t& value, const char*& buffer)
120 {
121 bool ok = true;
122 const uint32_t MAX_CONSUMED = 5;
123 uint32_t consumed = 0;
124 uint32_t decoded = 0;
125 uint8_t count = 0;
126 while (true)
127 {
128 uint8_t current = (uint8_t)*buffer++;
129 ++consumed;
130 decoded |= (current & 0x7f) << (7 * count++);
131 if (0 == (current & 0x80))
132 {
133 break;
134 }
135 else if (consumed > MAX_CONSUMED)
136 {
137 ok = false;
138 break;
139 }
140 }
141 value = decoded;
142 return ok;
143 }
144
145 enum SubType
146 {

Callers 1

ReadEncodedIndexFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected