Read vint from arbitrary byte array.
| 182 | |
| 183 | // Read vint from arbitrary byte array. |
| 184 | uint64 RawGetV(const byte *Data,uint &ReadPos,uint DataSize,bool &Overflow) |
| 185 | { |
| 186 | Overflow=false; |
| 187 | uint64 Result=0; |
| 188 | for (uint Shift=0;ReadPos<DataSize;Shift+=7) |
| 189 | { |
| 190 | byte CurByte=Data[ReadPos++]; |
| 191 | Result+=uint64(CurByte & 0x7f)<<Shift; |
| 192 | if ((CurByte & 0x80)==0) |
| 193 | return Result; // Decoded successfully. |
| 194 | } |
| 195 | Overflow=true; |
| 196 | return 0; // Out of buffer border. |
| 197 | } |
nothing calls this directly
no outgoing calls
no test coverage detected