File indexing completed on 2026-07-13 08:34:21
0001
0002
0003
0004
0005
0006
0007
0008 #ifndef GOOGLE_UPB_UPB_WIRE_INTERNAL_DECODE_FAST_DATALAYOUT_H__
0009 #define GOOGLE_UPB_UPB_WIRE_INTERNAL_DECODE_FAST_DATALAYOUT_H__
0010
0011 #include <stdint.h>
0012
0013
0014 #include "upb/port/def.inc"
0015
0016
0017
0018
0019
0020
0021
0022
0023
0024
0025
0026
0027
0028
0029
0030
0031
0032 UPB_INLINE bool upb_DecodeFast_MakeData(uint64_t offset, uint64_t case_offset,
0033 uint64_t presence,
0034 uint64_t submsg_index,
0035 uint64_t expected_tag,
0036 uint64_t* out_data) {
0037 if (offset > 0xffff || case_offset > 0xffff || presence > 0xff ||
0038 submsg_index > 0xff || expected_tag > 0xffff) {
0039 return false;
0040 }
0041
0042 *out_data = (offset << 48) | (case_offset << 32) | (presence << 24) |
0043 (submsg_index << 16) | expected_tag;
0044 return true;
0045 }
0046
0047 UPB_INLINE uint16_t upb_DecodeFastData_GetOffset(uint64_t data) {
0048 return data >> 48;
0049 }
0050
0051 UPB_INLINE uint16_t upb_DecodeFastData_GetCaseOffset(uint64_t data) {
0052 return data >> 32;
0053 }
0054
0055 UPB_INLINE uint8_t upb_DecodeFastData_GetPresence(uint64_t data) {
0056 return data >> 24;
0057 }
0058
0059 UPB_INLINE uint8_t upb_DecodeFastData_GetSubmsgIndex(uint64_t data) {
0060 return data >> 16;
0061 }
0062
0063 UPB_INLINE uint16_t upb_DecodeFastData_GetExpectedTag(uint64_t data) {
0064 return data;
0065 }
0066
0067 UPB_INLINE int upb_DecodeFastData_GetTableSlot(uint64_t data) {
0068 uint16_t tag = upb_DecodeFastData_GetExpectedTag(data);
0069 return (tag & 0xf8) >> 3;
0070 }
0071
0072 #include "upb/port/undef.inc"
0073
0074 #endif