Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-18 10:13:19

0001 // Protocol Buffers - Google's data interchange format
0002 // Copyright 2023 Google LLC.  All rights reserved.
0003 //
0004 // Use of this source code is governed by a BSD-style
0005 // license that can be found in the LICENSE file or at
0006 // https://developers.google.com/open-source/licenses/bsd
0007 
0008 // These are the specialized field parser functions for the fast parser.
0009 // Generated tables will refer to these by name.
0010 //
0011 // The function names are encoded with names like:
0012 //
0013 //   //  123 4
0014 //   upb_pss_1bt();   // Parse singular string, 1 byte tag.
0015 //
0016 // In position 1:
0017 //   - 'p' for parse, most function use this
0018 //   - 'c' for copy, for when we are copying strings instead of aliasing
0019 //
0020 // In position 2 (cardinality):
0021 //   - 's' for singular, with or without hasbit
0022 //   - 'o' for oneof
0023 //   - 'r' for non-packed repeated
0024 //   - 'p' for packed repeated
0025 //
0026 // In position 3 (type):
0027 //   - 'b1' for bool
0028 //   - 'v4' for 4-byte varint
0029 //   - 'v8' for 8-byte varint
0030 //   - 'z4' for zig-zag-encoded 4-byte varint
0031 //   - 'z8' for zig-zag-encoded 8-byte varint
0032 //   - 'f4' for 4-byte fixed
0033 //   - 'f8' for 8-byte fixed
0034 //   - 'm' for sub-message
0035 //   - 's' for string (validate UTF-8)
0036 //   - 'b' for bytes
0037 //
0038 // In position 4 (tag length):
0039 //   - '1' for one-byte tags (field numbers 1-15)
0040 //   - '2' for two-byte tags (field numbers 16-2048)
0041 
0042 #ifndef UPB_WIRE_INTERNAL_DECODE_FAST_H_
0043 #define UPB_WIRE_INTERNAL_DECODE_FAST_H_
0044 
0045 #include "upb/message/message.h"
0046 
0047 // Must be last.
0048 #include "upb/port/def.inc"
0049 
0050 #ifdef __cplusplus
0051 extern "C" {
0052 #endif
0053 
0054 struct upb_Decoder;
0055 
0056 // The fallback, generic parsing function that can handle any field type.
0057 // This just uses the regular (non-fast) parser to parse a single field.
0058 const char* _upb_FastDecoder_DecodeGeneric(struct upb_Decoder* d,
0059                                            const char* ptr, upb_Message* msg,
0060                                            intptr_t table, uint64_t hasbits,
0061                                            uint64_t data);
0062 
0063 #define UPB_PARSE_PARAMS                                                    \
0064   struct upb_Decoder *d, const char *ptr, upb_Message *msg, intptr_t table, \
0065       uint64_t hasbits, uint64_t data
0066 
0067 /* primitive fields ***********************************************************/
0068 
0069 #define F(card, type, valbytes, tagbytes) \
0070   const char* upb_p##card##type##valbytes##_##tagbytes##bt(UPB_PARSE_PARAMS);
0071 
0072 #define TYPES(card, tagbytes) \
0073   F(card, b, 1, tagbytes)     \
0074   F(card, v, 4, tagbytes)     \
0075   F(card, v, 8, tagbytes)     \
0076   F(card, z, 4, tagbytes)     \
0077   F(card, z, 8, tagbytes)     \
0078   F(card, f, 4, tagbytes)     \
0079   F(card, f, 8, tagbytes)
0080 
0081 #define TAGBYTES(card) \
0082   TYPES(card, 1)       \
0083   TYPES(card, 2)
0084 
0085 TAGBYTES(s)
0086 TAGBYTES(o)
0087 TAGBYTES(r)
0088 TAGBYTES(p)
0089 
0090 #undef F
0091 #undef TYPES
0092 #undef TAGBYTES
0093 
0094 /* string fields **************************************************************/
0095 
0096 #define F(card, tagbytes, type)                                     \
0097   const char* upb_p##card##type##_##tagbytes##bt(UPB_PARSE_PARAMS); \
0098   const char* upb_c##card##type##_##tagbytes##bt(UPB_PARSE_PARAMS);
0099 
0100 #define UTF8(card, tagbytes) \
0101   F(card, tagbytes, s)       \
0102   F(card, tagbytes, b)
0103 
0104 #define TAGBYTES(card) \
0105   UTF8(card, 1)        \
0106   UTF8(card, 2)
0107 
0108 TAGBYTES(s)
0109 TAGBYTES(o)
0110 TAGBYTES(r)
0111 
0112 #undef F
0113 #undef UTF8
0114 #undef TAGBYTES
0115 
0116 /* sub-message fields *********************************************************/
0117 
0118 #define F(card, tagbytes, size_ceil, ceil_arg) \
0119   const char* upb_p##card##m_##tagbytes##bt_max##size_ceil##b(UPB_PARSE_PARAMS);
0120 
0121 #define SIZES(card, tagbytes) \
0122   F(card, tagbytes, 64, 64)   \
0123   F(card, tagbytes, 128, 128) \
0124   F(card, tagbytes, 192, 192) \
0125   F(card, tagbytes, 256, 256) \
0126   F(card, tagbytes, max, -1)
0127 
0128 #define TAGBYTES(card) \
0129   SIZES(card, 1)       \
0130   SIZES(card, 2)
0131 
0132 TAGBYTES(s)
0133 TAGBYTES(o)
0134 TAGBYTES(r)
0135 
0136 #undef F
0137 #undef SIZES
0138 #undef TAGBYTES
0139 
0140 #undef UPB_PARSE_PARAMS
0141 
0142 #ifdef __cplusplus
0143 } /* extern "C" */
0144 #endif
0145 
0146 #include "upb/port/undef.inc"
0147 
0148 #endif /* UPB_WIRE_INTERNAL_DECODE_FAST_H_ */