Support dedicated path for skipping varints PiperOrigin-RevId: 931345587
diff --git a/upb/wire/reader.h b/upb/wire/reader.h index d190022..0a82bd7 100644 --- a/upb/wire/reader.h +++ b/upb/wire/reader.h
@@ -56,8 +56,14 @@ // by calling upb_EpsCopyInputStream_IsDone(). UPB_INLINE const char* upb_WireReader_SkipVarint( const char* ptr, upb_EpsCopyInputStream* stream) { - uint64_t val; - return upb_WireReader_ReadVarint(ptr, &val, stream); + UPB_PRIVATE(upb_EpsCopyInputStream_ConsumeBytes)(stream, 10); + const char* bound = ptr + 10; + do { + if ((*(ptr++) & 0x80) == 0) { + return ptr; + } + } while (ptr != bound); + return UPB_PRIVATE(upb_EpsCopyInputStream_ReturnError)(stream); } // Reads a varint indicating the size of a delimited field into `size`, or