comment "// Copyright 2025 Google LLC. All rights reserved."
preproc_ifdef
#ifndef "#ifndef"
identifier "UPB_WIRE_INTERNAL_DECODE_FAST_COMBINATIONS_H_"
preproc_def
#define "#define"
identifier "UPB_WIRE_INTERNAL_DECODE_FAST_COMBINATIONS_H_"
preproc_include
#include "#include"
system_lib_string "<stdint.h>"
preproc_include
#include "#include"
string_literal
" "\""
string_content "upb/base/internal/log2.h"
" "\""
preproc_include
#include "#include"
string_literal
" "\""
string_content "upb/wire/types.h"
" "\""
comment "// Must be last."
preproc_include
#include "#include"
string_literal
" "\""
string_content "upb/port/def.inc"
" "\""
comment "// Each fast function is specialized for a cardinality, type"...
comment "// These macros enumerate all possibilities for each of thes"...
comment "//"
comment "// These can be generated in any combination, except that no"...
comment "// cannot be packed. So we have:"
comment "// {1bt,2bt} x {s,o,r,p} x {b,v32,v64,z32,z64,f32,f64,ce} "...
comment "// {1bt,2bt} x {s,o,r} x {s,b,m} "...
preproc_function_def
#define "#define"
identifier "UPB_DECODEFAST_CARDINALITIES"
preproc_params
( "("
identifier "F"
, ","
... "..."
) ")"
preproc_arg "F(__VA_ARGS__, Scalar) \\\n F(__VA_ARGS__"...
preproc_function_def
#define "#define"
identifier "UPB_DECODEFAST_TYPES"
preproc_params
( "("
identifier "F"
, ","
... "..."
) ")"
preproc_arg "F(__VA_ARGS__, Bool) \\\n F(__VA_ARGS__, Varint"...
preproc_function_def
#define "#define"
identifier "UPB_DECODEFAST_TAGSIZES"
preproc_params
( "("
identifier "F"
, ","
... "..."
) ")"
preproc_arg "F(__VA_ARGS__, Tag1Byte) \\\n F(__VA_ARGS__, Tag"...
preproc_function_def
#define "#define"
identifier "ENUM_VAL"
preproc_params
( "("
identifier "_"
, ","
identifier "x"
) ")"
preproc_arg "kUpb_DecodeFast_##x,"
type_definition
typedef "typedef"
enum_specifier
enum "enum"
enumerator_list
{ "{"
enumerator
identifier "UPB_DECODEFAST_CARDINALITIES"
ERROR
( "("
identifier "ENUM_VAL"
) ")"
comment "// kUpb_DecodeFast_Scalar = 0, etc."
} "}"
type_identifier "upb_DecodeFast_Cardinality"
; ";"
type_definition
typedef "typedef"
enum_specifier
enum "enum"
enumerator_list
{ "{"
enumerator
identifier "UPB_DECODEFAST_TYPES"
ERROR
( "("
identifier "ENUM_VAL"
) ")"
comment "// kUpb_DecodeFast_Bool = 0, etc."
} "}"
type_identifier "upb_DecodeFast_Type"
; ";"
type_definition
typedef "typedef"
enum_specifier
enum "enum"
enumerator_list
{ "{"
enumerator
identifier "UPB_DECODEFAST_TAGSIZES"
ERROR
( "("
identifier "ENUM_VAL"
) ")"
comment "// kUpb_DecodeFast_Tag1Byte = 0, etc."
} "}"
type_identifier "upb_DecodeFast_TagSize"
; ";"
preproc_call
preproc_directive "#undef"
preproc_arg "ENUM_VAL"
preproc_function_def
#define "#define"
identifier "ADD"
preproc_params
( "("
identifier "_"
, ","
identifier "x"
) ")"
preproc_arg "+1"
enum_specifier (+36 nodes collapsed)
; ";"
preproc_call
preproc_directive "#undef"
preproc_arg "ADD"
comment "// Attributes of the various dimensions."
function_definition (+50 nodes collapsed)
function_definition (+90 nodes collapsed)
function_definition (+90 nodes collapsed)
function_definition (+29 nodes collapsed)
function_definition (+28 nodes collapsed)
function_definition (+43 nodes collapsed)
comment "// The canonical ordering of functions, used by the arrays o"...
comment "// and function names. This macro generates the full cross "...
comment "// cardinality, type, and tag size enums."
comment "//"
comment "// This ordering generates some combinations that are not ac"...
comment "// packed strings or messages), but it's simpler than trying"...
comment "// There are only 14 impossible combinations out of 120 tota"...
comment "// worth optimizing for."
preproc_function_def
#define "#define"
identifier "UPB_DECODEFAST_FUNCTIONS"
preproc_params
( "("
identifier "F"
) ")"
preproc_arg "UPB_DECODEFAST_TYPES(UPB_DECODEFAST_CARDINALITIES, UPB_DECOD"...
comment "// The canonical index of a given function. This must be ke"...
comment "// ordering above, such that this index selects the same fun"...
comment "// corresponding UPB_DECODEFAST_FUNCNAME() macro."
preproc_function_def
#define "#define"
identifier "UPB_DECODEFAST_FUNCTION_IDX"
preproc_params
( "("
identifier "type"
, ","
identifier "card"
, ","
identifier "size"
) ")"
preproc_arg "(((uint32_t)type * kUpb_DecodeFast_CardinalityCount * \\\n "...
comment "// Functions to decompose a function index into its constitu"...
function_definition (+30 nodes collapsed)
function_definition (+36 nodes collapsed)
function_definition (+36 nodes collapsed)
comment "// The canonical function name for a given cardinality, type"...
preproc_function_def
#define "#define"
identifier "UPB_DECODEFAST_FUNCNAME"
preproc_params
( "("
identifier "type"
, ","
identifier "card"
, ","
identifier "size"
) ")"
preproc_arg "upb_DecodeFast_##type##_##card##_##size"
comment "// Returns true if we should disable fast decode for this fu"...
comment "// useful for field types that are known not to work yet. I"...
comment "// bisecting a test failure to find which function(s) are br"...
comment "//"
comment "// This must be a macro because it must evaluate to a compil"...
comment "// since we use it when initializing the fastdecode function"...
comment "//"
comment "// This function only applies to field types that have been "...
comment "// index. Some field types (eg. groups) do not even have a "...
comment "// the moment, and so will be rejected by upb_DecodeFast_Try"...
comment "// we even get here."
preproc_function_def
#define "#define"
identifier "UPB_DECODEFAST_COMBINATION_IS_ENABLED"
preproc_params
( "("
identifier "type"
, ","
identifier "card"
, ","
identifier "size"
) ")"
preproc_arg "(type == kUpb_DecodeFast_Fixed32 || type == kUpb_DecodeFast_"...
preproc_ifdef (+30 nodes collapsed)
preproc_include
#include "#include"
string_literal
" "\""
string_content "upb/port/undef.inc"
" "\""
#endif "#endif"