Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2026-07-13 08:34:21

0001 // Protocol Buffers - Google's data interchange format
0002 // Copyright 2025 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 #ifndef UPB_WIRE_INTERNAL_DECODE_FAST_SELECT_H_
0009 #define UPB_WIRE_INTERNAL_DECODE_FAST_SELECT_H_
0010 
0011 #include <stddef.h>
0012 #include <stdint.h>
0013 
0014 #include "upb/mini_table/internal/message.h"
0015 #include "upb/mini_table/message.h"
0016 
0017 // Must be last.
0018 #include "upb/port/def.inc"
0019 
0020 #ifdef __cplusplus
0021 extern "C" {
0022 #endif
0023 
0024 typedef struct {
0025   // The function that will be called to parse this field.  The function
0026   // pointer for it must be placed into _upb_FastTable_Entry.field_parser.
0027   //
0028   // The function pointer can be either looked up at runtime via
0029   // upb_DecodeFast_GetFunctionPointer(), or be referenced in generated code via
0030   // upb_DecodeFast_GetFunctionName().
0031   uint32_t function_idx;
0032 
0033   // The associated data that will be passed to the function.  This must be
0034   // placed into _upb_FastTable_Entry.field_data.
0035   uint64_t function_data;
0036 } upb_DecodeFast_TableEntry;
0037 
0038 // Builds the fasttable for the given message.  The table will be written into
0039 // the given array.  Returns the number of entries in the table that were
0040 // actually used, and should be written to the MiniTable (this number may be
0041 // less than 32).
0042 //
0043 // This function will assume that the lower a field number, the hotter the field
0044 // is.  If at some point we get access to more information about field usage,
0045 // we should consider using that instead.
0046 int upb_DecodeFast_BuildTable(const upb_MiniTable* m,
0047                               upb_DecodeFast_TableEntry table[32]);
0048 
0049 // Returns the mask that should be placed into the table_mask field of the
0050 // mini table for the given table size.
0051 uint8_t upb_DecodeFast_GetTableMask(int table_size);
0052 
0053 // Translates a function index into the canonical function name which can be
0054 // emitted into generated code.
0055 const char* upb_DecodeFast_GetFunctionName(uint32_t function_idx);
0056 
0057 // Returns a function pointer for the given function index.
0058 _upb_FieldParser* upb_DecodeFast_GetFunctionPointer(uint32_t function_idx);
0059 
0060 #ifdef __cplusplus
0061 }  // extern "C"
0062 #endif
0063 
0064 #include "upb/port/undef.inc"
0065 
0066 #endif  // UPB_WIRE_INTERNAL_DECODE_FAST_SELECT_H_