|
|
|
@ -113,17 +113,17 @@ Error, UINTPTR_MAX is undefined |
|
|
|
|
|
|
|
|
|
// Macros for function attributes on compilers that support them.
|
|
|
|
|
#ifdef __GNUC__ |
|
|
|
|
#define UPB_FORCEINLINE __inline__ __attribute__((always_inline)) |
|
|
|
|
#define UPB_FORCEINLINE __inline__ __attribute__((always_inline)) static |
|
|
|
|
#define UPB_NOINLINE __attribute__((noinline)) |
|
|
|
|
#define UPB_NORETURN __attribute__((__noreturn__)) |
|
|
|
|
#define UPB_PRINTF(str, first_vararg) __attribute__((format (printf, str, first_vararg))) |
|
|
|
|
#elif defined(_MSC_VER) |
|
|
|
|
#define UPB_NOINLINE |
|
|
|
|
#define UPB_FORCEINLINE |
|
|
|
|
#define UPB_FORCEINLINE static |
|
|
|
|
#define UPB_NORETURN __declspec(noreturn) |
|
|
|
|
#define UPB_PRINTF(str, first_vararg) |
|
|
|
|
#else /* !defined(__GNUC__) */ |
|
|
|
|
#define UPB_FORCEINLINE |
|
|
|
|
#define UPB_FORCEINLINE static |
|
|
|
|
#define UPB_NOINLINE |
|
|
|
|
#define UPB_NORETURN |
|
|
|
|
#define UPB_PRINTF(str, first_vararg) |
|
|
|
@ -7202,8 +7202,8 @@ static _upb_DecodeLongVarintReturn _upb_Decoder_DecodeLongVarint( |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
UPB_FORCEINLINE |
|
|
|
|
static const char* _upb_Decoder_DecodeVarint(upb_Decoder* d, const char* ptr, |
|
|
|
|
uint64_t* val) { |
|
|
|
|
const char* _upb_Decoder_DecodeVarint(upb_Decoder* d, const char* ptr, |
|
|
|
|
uint64_t* val) { |
|
|
|
|
uint64_t byte = (uint8_t)*ptr; |
|
|
|
|
if (UPB_LIKELY((byte & 0x80) == 0)) { |
|
|
|
|
*val = byte; |
|
|
|
@ -7217,8 +7217,8 @@ static const char* _upb_Decoder_DecodeVarint(upb_Decoder* d, const char* ptr, |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
UPB_FORCEINLINE |
|
|
|
|
static const char* _upb_Decoder_DecodeTag(upb_Decoder* d, const char* ptr, |
|
|
|
|
uint32_t* val) { |
|
|
|
|
const char* _upb_Decoder_DecodeTag(upb_Decoder* d, const char* ptr, |
|
|
|
|
uint32_t* val) { |
|
|
|
|
uint64_t byte = (uint8_t)*ptr; |
|
|
|
|
if (UPB_LIKELY((byte & 0x80) == 0)) { |
|
|
|
|
*val = byte; |
|
|
|
@ -7235,8 +7235,8 @@ static const char* _upb_Decoder_DecodeTag(upb_Decoder* d, const char* ptr, |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
UPB_FORCEINLINE |
|
|
|
|
static const char* upb_Decoder_DecodeSize(upb_Decoder* d, const char* ptr, |
|
|
|
|
uint32_t* size) { |
|
|
|
|
const char* upb_Decoder_DecodeSize(upb_Decoder* d, const char* ptr, |
|
|
|
|
uint32_t* size) { |
|
|
|
|
uint64_t size64; |
|
|
|
|
ptr = _upb_Decoder_DecodeVarint(d, ptr, &size64); |
|
|
|
|
if (size64 >= INT32_MAX || |
|
|
|
@ -7338,11 +7338,10 @@ static const char* _upb_Decoder_ReadString(upb_Decoder* d, const char* ptr, |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
UPB_FORCEINLINE |
|
|
|
|
static const char* _upb_Decoder_RecurseSubMessage(upb_Decoder* d, |
|
|
|
|
const char* ptr, |
|
|
|
|
upb_Message* submsg, |
|
|
|
|
const upb_MiniTable* subl, |
|
|
|
|
uint32_t expected_end_group) { |
|
|
|
|
const char* _upb_Decoder_RecurseSubMessage(upb_Decoder* d, const char* ptr, |
|
|
|
|
upb_Message* submsg, |
|
|
|
|
const upb_MiniTable* subl, |
|
|
|
|
uint32_t expected_end_group) { |
|
|
|
|
if (--d->depth < 0) { |
|
|
|
|
_upb_Decoder_ErrorJmp(d, kUpb_DecodeStatus_MaxDepthExceeded); |
|
|
|
|
} |
|
|
|
@ -7355,9 +7354,11 @@ static const char* _upb_Decoder_RecurseSubMessage(upb_Decoder* d, |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
UPB_FORCEINLINE |
|
|
|
|
static const char* _upb_Decoder_DecodeSubMessage( |
|
|
|
|
upb_Decoder* d, const char* ptr, upb_Message* submsg, |
|
|
|
|
const upb_MiniTableSub* subs, const upb_MiniTableField* field, int size) { |
|
|
|
|
const char* _upb_Decoder_DecodeSubMessage(upb_Decoder* d, const char* ptr, |
|
|
|
|
upb_Message* submsg, |
|
|
|
|
const upb_MiniTableSub* subs, |
|
|
|
|
const upb_MiniTableField* field, |
|
|
|
|
int size) { |
|
|
|
|
int saved_delta = upb_EpsCopyInputStream_PushLimit(&d->input, ptr, size); |
|
|
|
|
const upb_MiniTable* subl = _upb_MiniTableSubs_MessageByField(subs, field); |
|
|
|
|
UPB_ASSERT(subl); |
|
|
|
@ -7367,10 +7368,10 @@ static const char* _upb_Decoder_DecodeSubMessage( |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
UPB_FORCEINLINE |
|
|
|
|
static const char* _upb_Decoder_DecodeGroup(upb_Decoder* d, const char* ptr, |
|
|
|
|
upb_Message* submsg, |
|
|
|
|
const upb_MiniTable* subl, |
|
|
|
|
uint32_t number) { |
|
|
|
|
const char* _upb_Decoder_DecodeGroup(upb_Decoder* d, const char* ptr, |
|
|
|
|
upb_Message* submsg, |
|
|
|
|
const upb_MiniTable* subl, |
|
|
|
|
uint32_t number) { |
|
|
|
|
if (_upb_Decoder_IsDone(d, &ptr)) { |
|
|
|
|
_upb_Decoder_ErrorJmp(d, kUpb_DecodeStatus_Malformed); |
|
|
|
|
} |
|
|
|
@ -7380,16 +7381,16 @@ static const char* _upb_Decoder_DecodeGroup(upb_Decoder* d, const char* ptr, |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
UPB_FORCEINLINE |
|
|
|
|
static const char* _upb_Decoder_DecodeUnknownGroup(upb_Decoder* d, |
|
|
|
|
const char* ptr, |
|
|
|
|
uint32_t number) { |
|
|
|
|
const char* _upb_Decoder_DecodeUnknownGroup(upb_Decoder* d, const char* ptr, |
|
|
|
|
uint32_t number) { |
|
|
|
|
return _upb_Decoder_DecodeGroup(d, ptr, NULL, NULL, number); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
UPB_FORCEINLINE |
|
|
|
|
static const char* _upb_Decoder_DecodeKnownGroup( |
|
|
|
|
upb_Decoder* d, const char* ptr, upb_Message* submsg, |
|
|
|
|
const upb_MiniTableSub* subs, const upb_MiniTableField* field) { |
|
|
|
|
const char* _upb_Decoder_DecodeKnownGroup(upb_Decoder* d, const char* ptr, |
|
|
|
|
upb_Message* submsg, |
|
|
|
|
const upb_MiniTableSub* subs, |
|
|
|
|
const upb_MiniTableField* field) { |
|
|
|
|
const upb_MiniTable* subl = _upb_MiniTableSubs_MessageByField(subs, field); |
|
|
|
|
UPB_ASSERT(subl); |
|
|
|
|
return _upb_Decoder_DecodeGroup(d, ptr, submsg, subl, |
|
|
|
@ -7419,10 +7420,9 @@ static void _upb_Decoder_AddUnknownVarints(upb_Decoder* d, upb_Message* msg, |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
UPB_FORCEINLINE |
|
|
|
|
static bool _upb_Decoder_CheckEnum(upb_Decoder* d, const char* ptr, |
|
|
|
|
upb_Message* msg, const upb_MiniTableEnum* e, |
|
|
|
|
const upb_MiniTableField* field, |
|
|
|
|
wireval* val) { |
|
|
|
|
bool _upb_Decoder_CheckEnum(upb_Decoder* d, const char* ptr, upb_Message* msg, |
|
|
|
|
const upb_MiniTableEnum* e, |
|
|
|
|
const upb_MiniTableField* field, wireval* val) { |
|
|
|
|
const uint32_t v = val->uint32_val; |
|
|
|
|
|
|
|
|
|
if (UPB_LIKELY(upb_MiniTableEnum_CheckValue(e, v))) return true; |
|
|
|
@ -7456,9 +7456,10 @@ static const char* _upb_Decoder_DecodeEnumArray(upb_Decoder* d, const char* ptr, |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
UPB_FORCEINLINE |
|
|
|
|
static const char* _upb_Decoder_DecodeFixedPacked( |
|
|
|
|
upb_Decoder* d, const char* ptr, upb_Array* arr, wireval* val, |
|
|
|
|
const upb_MiniTableField* field, int lg2) { |
|
|
|
|
const char* _upb_Decoder_DecodeFixedPacked(upb_Decoder* d, const char* ptr, |
|
|
|
|
upb_Array* arr, wireval* val, |
|
|
|
|
const upb_MiniTableField* field, |
|
|
|
|
int lg2) { |
|
|
|
|
int mask = (1 << lg2) - 1; |
|
|
|
|
size_t count = val->size >> lg2; |
|
|
|
|
if ((val->size & mask) != 0) { |
|
|
|
@ -7493,9 +7494,10 @@ static const char* _upb_Decoder_DecodeFixedPacked( |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
UPB_FORCEINLINE |
|
|
|
|
static const char* _upb_Decoder_DecodeVarintPacked( |
|
|
|
|
upb_Decoder* d, const char* ptr, upb_Array* arr, wireval* val, |
|
|
|
|
const upb_MiniTableField* field, int lg2) { |
|
|
|
|
const char* _upb_Decoder_DecodeVarintPacked(upb_Decoder* d, const char* ptr, |
|
|
|
|
upb_Array* arr, wireval* val, |
|
|
|
|
const upb_MiniTableField* field, |
|
|
|
|
int lg2) { |
|
|
|
|
int scale = 1 << lg2; |
|
|
|
|
int saved_limit = upb_EpsCopyInputStream_PushLimit(&d->input, ptr, val->size); |
|
|
|
|
char* out = UPB_PTR_AT(upb_Array_MutableDataPtr(arr), |
|
|
|
@ -7801,9 +7803,8 @@ const char* _upb_Decoder_CheckRequired(upb_Decoder* d, const char* ptr, |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
UPB_FORCEINLINE |
|
|
|
|
static bool _upb_Decoder_TryFastDispatch(upb_Decoder* d, const char** ptr, |
|
|
|
|
upb_Message* msg, |
|
|
|
|
const upb_MiniTable* m) { |
|
|
|
|
bool _upb_Decoder_TryFastDispatch(upb_Decoder* d, const char** ptr, |
|
|
|
|
upb_Message* msg, const upb_MiniTable* m) { |
|
|
|
|
#if UPB_FASTTABLE |
|
|
|
|
if (m && m->UPB_PRIVATE(table_mask) != (unsigned char)-1) { |
|
|
|
|
uint16_t tag = _upb_FastDecoder_LoadTag(*ptr); |
|
|
|
@ -8041,9 +8042,8 @@ static int _upb_Decoder_GetVarintOp(const upb_MiniTableField* field) { |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
UPB_FORCEINLINE |
|
|
|
|
static void _upb_Decoder_CheckUnlinked(upb_Decoder* d, const upb_MiniTable* mt, |
|
|
|
|
const upb_MiniTableField* field, |
|
|
|
|
int* op) { |
|
|
|
|
void _upb_Decoder_CheckUnlinked(upb_Decoder* d, const upb_MiniTable* mt, |
|
|
|
|
const upb_MiniTableField* field, int* op) { |
|
|
|
|
// If sub-message is not linked, treat as unknown.
|
|
|
|
|
if (field->UPB_PRIVATE(mode) & kUpb_LabelFlags_IsExtension) return; |
|
|
|
|
const upb_MiniTable* mt_sub = |
|
|
|
@ -8069,9 +8069,8 @@ static void _upb_Decoder_CheckUnlinked(upb_Decoder* d, const upb_MiniTable* mt, |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
UPB_FORCEINLINE |
|
|
|
|
static void _upb_Decoder_MaybeVerifyUtf8(upb_Decoder* d, |
|
|
|
|
const upb_MiniTableField* field, |
|
|
|
|
int* op) { |
|
|
|
|
void _upb_Decoder_MaybeVerifyUtf8(upb_Decoder* d, |
|
|
|
|
const upb_MiniTableField* field, int* op) { |
|
|
|
|
if ((field->UPB_ONLYBITS(mode) & kUpb_LabelFlags_IsAlternate) && |
|
|
|
|
UPB_UNLIKELY(d->options & kUpb_DecodeOption_AlwaysValidateUtf8)) |
|
|
|
|
*op = kUpb_DecodeOp_String; |
|
|
|
@ -8141,11 +8140,10 @@ static int _upb_Decoder_GetDelimitedOp(upb_Decoder* d, const upb_MiniTable* mt, |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
UPB_FORCEINLINE |
|
|
|
|
static const char* _upb_Decoder_DecodeWireValue(upb_Decoder* d, const char* ptr, |
|
|
|
|
const upb_MiniTable* mt, |
|
|
|
|
const upb_MiniTableField* field, |
|
|
|
|
int wire_type, wireval* val, |
|
|
|
|
int* op) { |
|
|
|
|
const char* _upb_Decoder_DecodeWireValue(upb_Decoder* d, const char* ptr, |
|
|
|
|
const upb_MiniTable* mt, |
|
|
|
|
const upb_MiniTableField* field, |
|
|
|
|
int wire_type, wireval* val, int* op) { |
|
|
|
|
static const unsigned kFixed32OkMask = (1 << kUpb_FieldType_Float) | |
|
|
|
|
(1 << kUpb_FieldType_Fixed32) | |
|
|
|
|
(1 << kUpb_FieldType_SFixed32); |
|
|
|
@ -8195,10 +8193,11 @@ static const char* _upb_Decoder_DecodeWireValue(upb_Decoder* d, const char* ptr, |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
UPB_FORCEINLINE |
|
|
|
|
static const char* _upb_Decoder_DecodeKnownField( |
|
|
|
|
upb_Decoder* d, const char* ptr, upb_Message* msg, |
|
|
|
|
const upb_MiniTable* layout, const upb_MiniTableField* field, int op, |
|
|
|
|
wireval* val) { |
|
|
|
|
const char* _upb_Decoder_DecodeKnownField(upb_Decoder* d, const char* ptr, |
|
|
|
|
upb_Message* msg, |
|
|
|
|
const upb_MiniTable* layout, |
|
|
|
|
const upb_MiniTableField* field, |
|
|
|
|
int op, wireval* val) { |
|
|
|
|
const upb_MiniTableSub* subs = layout->UPB_PRIVATE(subs); |
|
|
|
|
uint8_t mode = field->UPB_PRIVATE(mode); |
|
|
|
|
|
|
|
|
@ -8515,7 +8514,7 @@ static void encode_growbuffer(upb_encstate* e, size_t bytes) { |
|
|
|
|
/* Call to ensure that at least "bytes" bytes are available for writing at
|
|
|
|
|
* e->ptr. Returns false if the bytes could not be allocated. */ |
|
|
|
|
UPB_FORCEINLINE |
|
|
|
|
static void encode_reserve(upb_encstate* e, size_t bytes) { |
|
|
|
|
void encode_reserve(upb_encstate* e, size_t bytes) { |
|
|
|
|
if ((size_t)(e->ptr - e->buf) < bytes) { |
|
|
|
|
encode_growbuffer(e, bytes); |
|
|
|
|
return; |
|
|
|
@ -8554,7 +8553,7 @@ static void encode_longvarint(upb_encstate* e, uint64_t val) { |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
UPB_FORCEINLINE |
|
|
|
|
static void encode_varint(upb_encstate* e, uint64_t val) { |
|
|
|
|
void encode_varint(upb_encstate* e, uint64_t val) { |
|
|
|
|
if (val < 128 && e->ptr != e->buf) { |
|
|
|
|
--e->ptr; |
|
|
|
|
*e->ptr = val; |
|
|
|
@ -9100,7 +9099,7 @@ static const char* fastdecode_isdonefallback(UPB_PARSE_PARAMS) { |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
UPB_FORCEINLINE |
|
|
|
|
static const char* fastdecode_dispatch(UPB_PARSE_PARAMS) { |
|
|
|
|
const char* fastdecode_dispatch(UPB_PARSE_PARAMS) { |
|
|
|
|
int overrun; |
|
|
|
|
switch (upb_EpsCopyInputStream_IsDoneStatus(&d->input, ptr, &overrun)) { |
|
|
|
|
case kUpb_IsDoneStatus_Done: |
|
|
|
@ -9122,7 +9121,7 @@ static const char* fastdecode_dispatch(UPB_PARSE_PARAMS) { |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
UPB_FORCEINLINE |
|
|
|
|
static bool fastdecode_checktag(uint16_t data, int tagbytes) { |
|
|
|
|
bool fastdecode_checktag(uint16_t data, int tagbytes) { |
|
|
|
|
if (tagbytes == 1) { |
|
|
|
|
return (data & 0xff) == 0; |
|
|
|
|
} else { |
|
|
|
@ -9131,7 +9130,7 @@ static bool fastdecode_checktag(uint16_t data, int tagbytes) { |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
UPB_FORCEINLINE |
|
|
|
|
static const char* fastdecode_longsize(const char* ptr, int* size) { |
|
|
|
|
const char* fastdecode_longsize(const char* ptr, int* size) { |
|
|
|
|
int i; |
|
|
|
|
UPB_ASSERT(*size & 0x80); |
|
|
|
|
*size &= 0xff; |
|
|
|
@ -9151,7 +9150,7 @@ static const char* fastdecode_longsize(const char* ptr, int* size) { |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
UPB_FORCEINLINE |
|
|
|
|
static const char* fastdecode_delimited( |
|
|
|
|
const char* fastdecode_delimited( |
|
|
|
|
upb_Decoder* d, const char* ptr, |
|
|
|
|
upb_EpsCopyInputStream_ParseDelimitedFunc* func, void* ctx) { |
|
|
|
|
ptr++; |
|
|
|
@ -9204,8 +9203,8 @@ typedef struct { |
|
|
|
|
} fastdecode_nextret; |
|
|
|
|
|
|
|
|
|
UPB_FORCEINLINE |
|
|
|
|
static void* fastdecode_resizearr(upb_Decoder* d, void* dst, |
|
|
|
|
fastdecode_arr* farr, int valbytes) { |
|
|
|
|
void* fastdecode_resizearr(upb_Decoder* d, void* dst, fastdecode_arr* farr, |
|
|
|
|
int valbytes) { |
|
|
|
|
if (UPB_UNLIKELY(dst == farr->end)) { |
|
|
|
|
size_t old_capacity = farr->arr->UPB_PRIVATE(capacity); |
|
|
|
|
size_t old_bytes = old_capacity * valbytes; |
|
|
|
@ -9223,7 +9222,7 @@ static void* fastdecode_resizearr(upb_Decoder* d, void* dst, |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
UPB_FORCEINLINE |
|
|
|
|
static bool fastdecode_tagmatch(uint32_t tag, uint64_t data, int tagbytes) { |
|
|
|
|
bool fastdecode_tagmatch(uint32_t tag, uint64_t data, int tagbytes) { |
|
|
|
|
if (tagbytes == 1) { |
|
|
|
|
return (uint8_t)tag == (uint8_t)data; |
|
|
|
|
} else { |
|
|
|
@ -9232,19 +9231,17 @@ static bool fastdecode_tagmatch(uint32_t tag, uint64_t data, int tagbytes) { |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
UPB_FORCEINLINE |
|
|
|
|
static void fastdecode_commitarr(void* dst, fastdecode_arr* farr, |
|
|
|
|
int valbytes) { |
|
|
|
|
void fastdecode_commitarr(void* dst, fastdecode_arr* farr, int valbytes) { |
|
|
|
|
farr->arr->UPB_PRIVATE(size) = |
|
|
|
|
(size_t)((char*)dst - (char*)upb_Array_MutableDataPtr(farr->arr)) / |
|
|
|
|
valbytes; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
UPB_FORCEINLINE |
|
|
|
|
static fastdecode_nextret fastdecode_nextrepeated(upb_Decoder* d, void* dst, |
|
|
|
|
const char** ptr, |
|
|
|
|
fastdecode_arr* farr, |
|
|
|
|
uint64_t data, int tagbytes, |
|
|
|
|
int valbytes) { |
|
|
|
|
fastdecode_nextret fastdecode_nextrepeated(upb_Decoder* d, void* dst, |
|
|
|
|
const char** ptr, |
|
|
|
|
fastdecode_arr* farr, uint64_t data, |
|
|
|
|
int tagbytes, int valbytes) { |
|
|
|
|
fastdecode_nextret ret; |
|
|
|
|
dst = (char*)dst + valbytes; |
|
|
|
|
|
|
|
|
@ -9266,16 +9263,15 @@ static fastdecode_nextret fastdecode_nextrepeated(upb_Decoder* d, void* dst, |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
UPB_FORCEINLINE |
|
|
|
|
static void* fastdecode_fieldmem(upb_Message* msg, uint64_t data) { |
|
|
|
|
void* fastdecode_fieldmem(upb_Message* msg, uint64_t data) { |
|
|
|
|
size_t ofs = data >> 48; |
|
|
|
|
return (char*)msg + ofs; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
UPB_FORCEINLINE |
|
|
|
|
static void* fastdecode_getfield(upb_Decoder* d, const char* ptr, |
|
|
|
|
upb_Message* msg, uint64_t* data, |
|
|
|
|
uint64_t* hasbits, fastdecode_arr* farr, |
|
|
|
|
int valbytes, upb_card card) { |
|
|
|
|
void* fastdecode_getfield(upb_Decoder* d, const char* ptr, upb_Message* msg, |
|
|
|
|
uint64_t* data, uint64_t* hasbits, |
|
|
|
|
fastdecode_arr* farr, int valbytes, upb_card card) { |
|
|
|
|
switch (card) { |
|
|
|
|
case CARD_s: { |
|
|
|
|
uint8_t hasbit_index = *data >> 24; |
|
|
|
@ -9314,7 +9310,7 @@ static void* fastdecode_getfield(upb_Decoder* d, const char* ptr, |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
UPB_FORCEINLINE |
|
|
|
|
static bool fastdecode_flippacked(uint64_t* data, int tagbytes) { |
|
|
|
|
bool fastdecode_flippacked(uint64_t* data, int tagbytes) { |
|
|
|
|
*data ^= (0x2 ^ 0x0); // Patch data to match packed wiretype.
|
|
|
|
|
return fastdecode_checktag(*data, tagbytes); |
|
|
|
|
} |
|
|
|
@ -9330,7 +9326,7 @@ static bool fastdecode_flippacked(uint64_t* data, int tagbytes) { |
|
|
|
|
/* varint fields **************************************************************/ |
|
|
|
|
|
|
|
|
|
UPB_FORCEINLINE |
|
|
|
|
static uint64_t fastdecode_munge(uint64_t val, int valbytes, bool zigzag) { |
|
|
|
|
uint64_t fastdecode_munge(uint64_t val, int valbytes, bool zigzag) { |
|
|
|
|
if (valbytes == 1) { |
|
|
|
|
return val != 0; |
|
|
|
|
} else if (zigzag) { |
|
|
|
@ -9346,7 +9342,7 @@ static uint64_t fastdecode_munge(uint64_t val, int valbytes, bool zigzag) { |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
UPB_FORCEINLINE |
|
|
|
|
static const char* fastdecode_varint64(const char* ptr, uint64_t* val) { |
|
|
|
|
const char* fastdecode_varint64(const char* ptr, uint64_t* val) { |
|
|
|
|
ptr++; |
|
|
|
|
*val = (uint8_t)ptr[-1]; |
|
|
|
|
if (UPB_UNLIKELY(*val & 0x80)) { |
|
|
|
@ -9421,8 +9417,8 @@ typedef struct { |
|
|
|
|
} fastdecode_varintdata; |
|
|
|
|
|
|
|
|
|
UPB_FORCEINLINE |
|
|
|
|
static const char* fastdecode_topackedvarint(upb_EpsCopyInputStream* e, |
|
|
|
|
const char* ptr, void* ctx) { |
|
|
|
|
const char* fastdecode_topackedvarint(upb_EpsCopyInputStream* e, |
|
|
|
|
const char* ptr, void* ctx) { |
|
|
|
|
upb_Decoder* d = (upb_Decoder*)e; |
|
|
|
|
fastdecode_varintdata* data = ctx; |
|
|
|
|
void* dst = data->dst; |
|
|
|
@ -9701,9 +9697,8 @@ static const char* fastdecode_longstring_noutf8( |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
UPB_FORCEINLINE |
|
|
|
|
static void fastdecode_docopy(upb_Decoder* d, const char* ptr, uint32_t size, |
|
|
|
|
int copy, char* data, size_t data_offset, |
|
|
|
|
upb_StringView* dst) { |
|
|
|
|
void fastdecode_docopy(upb_Decoder* d, const char* ptr, uint32_t size, int copy, |
|
|
|
|
char* data, size_t data_offset, upb_StringView* dst) { |
|
|
|
|
d->arena.UPB_PRIVATE(ptr) += copy; |
|
|
|
|
dst->data = data + data_offset; |
|
|
|
|
UPB_UNPOISON_MEMORY_REGION(data, copy); |
|
|
|
@ -9934,8 +9929,8 @@ typedef struct { |
|
|
|
|
} fastdecode_submsgdata; |
|
|
|
|
|
|
|
|
|
UPB_FORCEINLINE |
|
|
|
|
static const char* fastdecode_tosubmsg(upb_EpsCopyInputStream* e, |
|
|
|
|
const char* ptr, void* ctx) { |
|
|
|
|
const char* fastdecode_tosubmsg(upb_EpsCopyInputStream* e, const char* ptr, |
|
|
|
|
void* ctx) { |
|
|
|
|
upb_Decoder* d = (upb_Decoder*)e; |
|
|
|
|
fastdecode_submsgdata* submsg = ctx; |
|
|
|
|
ptr = fastdecode_dispatch(d, ptr, submsg->msg, submsg->table, 0, 0); |
|
|
|
|