You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
33 lines
733 B
33 lines
733 B
6 years ago
|
/*
|
||
|
* Copyright (c) 2019-present, Facebook, Inc.
|
||
|
*
|
||
|
* This source code is licensed under the MIT license found in the
|
||
|
* LICENSE file in the root directory of this source tree.
|
||
|
*/
|
||
|
#include <stdint.h>
|
||
|
|
||
|
const char* GetVarint64Ptr(const char* p, const char* limit) {
|
||
|
for (uint32_t shift = 0; shift <= 63 && p < limit; shift += 7) {
|
||
|
uint64_t byte = *p;
|
||
|
p++;
|
||
|
if (!(byte & 128)) {
|
||
|
return p;
|
||
|
}
|
||
|
}
|
||
|
return 0;
|
||
|
}
|
||
|
|
||
|
char* data_;
|
||
|
|
||
|
void DecodeCurrentValue() {
|
||
|
const char* limit = data_ + 1;
|
||
|
const char* newp = GetVarint64Ptr(data_, limit);
|
||
|
while (!newp) {
|
||
|
}
|
||
|
newp = GetVarint64Ptr(newp, limit);
|
||
|
while (!newp) {
|
||
|
}
|
||
|
// TODO: ensure this does not trigger assertion failure in Absarray (see
|
||
|
// T42274983)
|
||
|
}
|