summaryrefslogtreecommitdiff
path: root/upb/msg.h
diff options
context:
space:
mode:
authorJosh Haberman <jhaberman@gmail.com>2018-09-06 18:10:45 -0700
committerJosh Haberman <jhaberman@gmail.com>2018-09-06 18:10:45 -0700
commit340bd013380f23eeb3aadd6d1eb0209c5fe7312e (patch)
tree26e11ecb0f79cf5fc2365d435a99fec0058a6787 /upb/msg.h
parent3d511104acf016e1cd3ca9352193c5aeb00d4aa4 (diff)
Removed default instance and oneof array from tables.
Diffstat (limited to 'upb/msg.h')
-rw-r--r--upb/msg.h25
1 files changed, 4 insertions, 21 deletions
diff --git a/upb/msg.h b/upb/msg.h
index 557a1f4..8236799 100644
--- a/upb/msg.h
+++ b/upb/msg.h
@@ -53,42 +53,25 @@ typedef void upb_msg;
* members are public so generated code can initialize them, but users MUST NOT
* read or write any of its members. */
-#define UPB_NOT_IN_ONEOF UINT16_MAX
-#define UPB_NO_HASBIT UINT16_MAX
-#define UPB_NO_SUBMSG UINT16_MAX
-
typedef struct {
uint32_t number;
- uint32_t offset; /* If in a oneof, offset of default in default_msg below. */
- uint16_t hasbit; /* UPB_NO_HASBIT if no hasbit. */
- uint16_t oneof_index; /* UPB_NOT_IN_ONEOF if not in a oneof. */
- uint16_t submsg_index; /* UPB_NO_SUBMSG if no submsg. */
+ uint16_t offset;
+ int16_t presence; /* If >0, hasbit_index+1. If <0, oneof_index+1. */
+ uint16_t submsg_index; /* undefined if descriptortype != MESSAGE or GROUP. */
uint8_t descriptortype;
uint8_t label;
} upb_msglayout_field;
-typedef struct {
- uint32_t data_offset;
- uint32_t case_offset;
-} upb_msglayout_oneof;
-
typedef struct upb_msglayout {
const struct upb_msglayout *const* submsgs;
const upb_msglayout_field *fields;
- const upb_msglayout_oneof *oneofs;
- void *default_msg;
/* Must be aligned to sizeof(void*). Doesn't include internal members like
* unknown fields, extension dict, pointer to msglayout, etc. */
- uint32_t size;
+ uint16_t size;
uint16_t field_count;
- uint16_t oneof_count;
bool extendable;
- bool is_proto2;
} upb_msglayout;
-#define UPB_ALIGN_UP_TO(val, align) ((val + (align - 1)) & -align)
-#define UPB_ALIGNED_SIZEOF(type) UPB_ALIGN_UP_TO(sizeof(type), sizeof(void*))
-
/** upb_stringview ************************************************************/
generated by cgit on debian on lair
contact matthew@masot.net with questions or feedback