Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-30 10:25:23

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 #ifndef UPB_MINI_TABLE_TAGGED_PTR_H_
0009 #define UPB_MINI_TABLE_TAGGED_PTR_H_
0010 
0011 #include <stdint.h>
0012 
0013 #include "upb/message/internal/tagged_ptr.h"
0014 #include "upb/message/message.h"
0015 
0016 // Must be last.
0017 #include "upb/port/def.inc"
0018 
0019 // When a upb_Message* is stored in a message, array, or map, it is stored in a
0020 // tagged form. If the tag bit is set, the referenced upb_Message is of type
0021 // _kUpb_MiniTable_Empty (a sentinel message type with no fields) instead of
0022 // that field's true message type. This forms the basis of what we call
0023 // "dynamic tree shaking."
0024 //
0025 // See the documentation for kUpb_DecodeOption_ExperimentalAllowUnlinked for
0026 // more information.
0027 
0028 typedef uintptr_t upb_TaggedMessagePtr;
0029 
0030 #ifdef __cplusplus
0031 extern "C" {
0032 #endif
0033 
0034 // Users who enable unlinked sub-messages must use this to test whether a
0035 // message is empty before accessing it. If a message is empty, it must be
0036 // first promoted using the interfaces in message/promote.h.
0037 UPB_API_INLINE bool upb_TaggedMessagePtr_IsEmpty(upb_TaggedMessagePtr ptr);
0038 
0039 UPB_API_INLINE upb_Message* upb_TaggedMessagePtr_GetNonEmptyMessage(
0040     upb_TaggedMessagePtr ptr);
0041 
0042 #ifdef __cplusplus
0043 } /* extern "C" */
0044 #endif
0045 
0046 #include "upb/port/undef.inc"
0047 
0048 #endif /* UPB_MINI_TABLE_TAGGED_PTR_H_ */