Protocol Buffers - Google's data interchange format (grpc依赖)
https://developers.google.com/protocol-buffers/
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
19 lines
686 B
19 lines
686 B
6 years ago
|
|
||
|
#if UINTPTR_MAX == 0xffffffff
|
||
|
#define UPB_SIZE(size32, size64) size32
|
||
|
#else
|
||
|
#define UPB_SIZE(size32, size64) size64
|
||
|
#endif
|
||
|
|
||
|
#define UPB_FIELD_AT(msg, fieldtype, offset) \
|
||
|
*(fieldtype*)((const char*)(msg) + offset)
|
||
|
|
||
|
#define UPB_READ_ONEOF(msg, fieldtype, offset, case_offset, case_val, default) \
|
||
|
UPB_FIELD_AT(msg, int, case_offset) == case_val \
|
||
|
? UPB_FIELD_AT(msg, fieldtype, offset) \
|
||
|
: default
|
||
|
|
||
|
#define UPB_WRITE_ONEOF(msg, fieldtype, offset, value, case_offset, case_val) \
|
||
|
UPB_FIELD_AT(msg, int, case_offset) = case_val; \
|
||
|
UPB_FIELD_AT(msg, fieldtype, offset) = value;
|