|
|
|
@ -28,6 +28,9 @@ |
|
|
|
|
#ifndef UPB_BASE_DESCRIPTOR_CONSTANTS_H_ |
|
|
|
|
#define UPB_BASE_DESCRIPTOR_CONSTANTS_H_ |
|
|
|
|
|
|
|
|
|
// Must be last.
|
|
|
|
|
#include "upb/port/def.inc" |
|
|
|
|
|
|
|
|
|
// The types a field can have. Note that this list is not identical to the
|
|
|
|
|
// types defined in descriptor.proto, which gives INT32 and SINT32 separate
|
|
|
|
|
// types (we distinguish the two with the "integer encoding" enum below).
|
|
|
|
@ -77,4 +80,25 @@ typedef enum { |
|
|
|
|
|
|
|
|
|
#define kUpb_FieldType_SizeOf 19 |
|
|
|
|
|
|
|
|
|
#ifdef __cplusplus |
|
|
|
|
extern "C" { |
|
|
|
|
#endif |
|
|
|
|
|
|
|
|
|
UPB_INLINE bool upb_FieldType_IsPackable(upb_FieldType type) { |
|
|
|
|
// clang-format off
|
|
|
|
|
const unsigned kUnpackableTypes = |
|
|
|
|
(1 << kUpb_FieldType_String) | |
|
|
|
|
(1 << kUpb_FieldType_Bytes) | |
|
|
|
|
(1 << kUpb_FieldType_Message) | |
|
|
|
|
(1 << kUpb_FieldType_Group); |
|
|
|
|
// clang-format on
|
|
|
|
|
return (1 << type) & ~kUnpackableTypes; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
#ifdef __cplusplus |
|
|
|
|
} /* extern "C" */ |
|
|
|
|
#endif |
|
|
|
|
|
|
|
|
|
#include "upb/port/undef.inc" |
|
|
|
|
|
|
|
|
|
#endif /* UPB_BASE_DESCRIPTOR_CONSTANTS_H_ */ |
|
|
|
|