Added comment to decode_fast.h.

pull/13171/head
Joshua Haberman 4 years ago
parent bd9f8f580d
commit 46eb82467a
  1. 4
      upb/decode_fast.c
  2. 27
      upb/decode_fast.h

@ -491,6 +491,7 @@ static const char *fastdecode_varint(UPB_PARSE_PARAMS, int tagbytes,
* {s,o,r,p} x {b1,v4,z4,v8,z8} x {1bt,2bt} */
#define F(card, type, valbytes, tagbytes) \
UPB_NOINLINE \
const char *upb_p##card##type##valbytes##_##tagbytes##bt(UPB_PARSE_PARAMS) { \
return fastdecode_varint(UPB_PARSE_ARGS, tagbytes, valbytes, CARD_##card, \
type##_ZZ, \
@ -621,7 +622,7 @@ static const char *fastdecode_packedfixed(UPB_PARSE_PARAMS, int tagbytes,
return fastdecode_dispatch(d, ptr + size, msg, table, hasbits);
}
UPB_FORCEINLINE
static const char *fastdecode_fixed(UPB_PARSE_PARAMS, int tagbytes,
int valbytes, upb_card card,
_upb_field_parser *unpacked,
@ -638,6 +639,7 @@ static const char *fastdecode_fixed(UPB_PARSE_PARAMS, int tagbytes,
* {s,o,r,p} x {f4,f8} x {1bt,2bt} */
#define F(card, valbytes, tagbytes) \
UPB_NOINLINE \
const char *upb_p##card##f##valbytes##_##tagbytes##bt(UPB_PARSE_PARAMS) { \
return fastdecode_fixed(UPB_PARSE_ARGS, tagbytes, valbytes, CARD_##card, \
&upb_ppf##valbytes##_##tagbytes##bt, \

@ -1,8 +1,31 @@
// These are the specialized field parser functions for the fast parser.
// Generated tables will refer to these by name.
//
// Here we follow the same pattern of macros used in decode_fast.c to declare
// all of the variants.
// The function names are encoded with names like:
//
// // 123
// upb_pss_1bt(); // Parse singular string, 1 byte tag.
//
// In position 1:
// - 'p' for parse, most function use this
// - 'c' for copy, for when we are copying strings instead of aliasing
//
// In position 2 (cardinality):
// - 's' for singular, with or without hasbit
// - 'o' for oneof
// - 'r' for non-packed repeated
// - 'p' for packed repeated
//
// In position 3 (type):
// - 'b1' for bool
// - 'v4' for 4-byte varint
// - 'v8' for 8-byte varint
// - 'z4' for zig-zag-encoded 4-byte varint
// - 'z8' for zig-zag-encoded 8-byte varint
// - 'f4' for 4-byte fixed
// - 'f8' for 8-byte fixed
// - 'm' for sub-message
// - 's' for string
#ifndef UPB_DECODE_FAST_H_
#define UPB_DECODE_FAST_H_

Loading…
Cancel
Save