Back to home page

EIC code displayed by LXR

 
 

    


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

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_MESSAGE_INTERNAL_MAP_ENTRY_H_
0009 #define UPB_MESSAGE_INTERNAL_MAP_ENTRY_H_
0010 
0011 #include <stdint.h>
0012 
0013 #include "upb/base/string_view.h"
0014 #include "upb/hash/common.h"
0015 #include "upb/message/internal/types.h"
0016 
0017 // Map entries aren't actually stored for map fields, they are only used during
0018 // parsing. (It helps a lot if all map entry messages have the same layout.)
0019 // The mini_table layout code will ensure that all map entries have this layout.
0020 //
0021 // Note that users can and do create map entries directly, which will also use
0022 // this layout.
0023 
0024 typedef struct {
0025   struct upb_Message message;
0026   // We only need 2 hasbits max, but due to alignment we'll use 8 bytes here,
0027   // and the uint64_t helps make this clear.
0028   uint64_t hasbits;
0029   union {
0030     upb_StringView str;  // For str/bytes.
0031     upb_value val;       // For all other types.
0032     double d[2];         // Padding for 32-bit builds.
0033   } k;
0034   union {
0035     upb_StringView str;  // For str/bytes.
0036     upb_value val;       // For all other types.
0037     double d[2];         // Padding for 32-bit builds.
0038   } v;
0039 } upb_MapEntry;
0040 
0041 #endif  // UPB_MESSAGE_INTERNAL_MAP_ENTRY_H_