WPILibC++ 2027.0.0-alpha-3
Loading...
Searching...
No Matches
map_entry.h
Go to the documentation of this file.
1// Protocol Buffers - Google's data interchange format
2// Copyright 2023 Google LLC. All rights reserved.
3//
4// Use of this source code is governed by a BSD-style
5// license that can be found in the LICENSE file or at
6// https://developers.google.com/open-source/licenses/bsd
7
8#ifndef UPB_MESSAGE_INTERNAL_MAP_ENTRY_H_
9#define UPB_MESSAGE_INTERNAL_MAP_ENTRY_H_
10
11#include <stdint.h>
12
14#include "upb/hash/common.h"
16
17// Map entries aren't actually stored for map fields, they are only used during
18// parsing. (It helps a lot if all map entry messages have the same layout.)
19// The mini_table layout code will ensure that all map entries have this layout.
20//
21// Note that users can and do create map entries directly, which will also use
22// this layout.
23
24typedef struct {
25 struct upb_Message message;
26 // We only need 2 hasbits max, but due to alignment we'll use 8 bytes here,
27 // and the uint64_t helps make this clear.
28 uint64_t hasbits;
29 union {
30 upb_StringView str; // For str/bytes.
31 upb_value val; // For all other types.
32 double d[2]; // Padding for 32-bit builds.
33 } k;
34 union {
35 upb_StringView str; // For str/bytes.
36 upb_value val; // For all other types.
37 double d[2]; // Padding for 32-bit builds.
38 } v;
40
41#endif // UPB_MESSAGE_INTERNAL_MAP_ENTRY_H_
Definition map_entry.h:24
upb_StringView str
Definition map_entry.h:30
upb_value val
Definition map_entry.h:31
uint64_t hasbits
Definition map_entry.h:28
Definition types.h:18
double d
Definition types.h:21
Definition string_view.h:23
Definition common.h:44