123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137 |
- #ifndef GOOGLE_PROTOBUF_GENERATED_MESSAGE_TCTABLE_DECL_H__
- #define GOOGLE_PROTOBUF_GENERATED_MESSAGE_TCTABLE_DECL_H__
- #include <cstdint>
- #include <type_traits>
- #include <google/protobuf/parse_context.h>
- #include <google/protobuf/message_lite.h>
- #include <google/protobuf/port_def.inc>
- namespace google {
- namespace protobuf {
- namespace internal {
- struct TcFieldData {
- constexpr TcFieldData() : data(0) {}
- constexpr TcFieldData(uint16_t coded_tag, uint8_t hasbit_idx, uint16_t offset)
- : data(static_cast<uint64_t>(offset) << 48 |
- static_cast<uint64_t>(hasbit_idx) << 16 | coded_tag) {}
- template <typename TagType = uint16_t>
- TagType coded_tag() const {
- return static_cast<TagType>(data);
- }
- uint8_t hasbit_idx() const { return static_cast<uint8_t>(data >> 16); }
- uint16_t offset() const { return static_cast<uint16_t>(data >> 48); }
- uint64_t data;
- };
- struct TailCallParseTableBase;
- typedef const char* (*TailCallParseFunc)(PROTOBUF_TC_PARAM_DECL);
- #if defined(_MSC_VER) && !defined(_WIN64)
- #pragma warning(push)
- #pragma warning(disable : 4324)
- #endif
- struct alignas(uint64_t) TailCallParseTableBase {
-
- uint16_t has_bits_offset;
- uint16_t extension_offset;
- uint32_t extension_range_low;
- uint32_t extension_range_high;
- const MessageLite* default_instance;
-
- TailCallParseFunc fallback;
-
- struct FieldEntry {
-
- TailCallParseFunc target;
-
- TcFieldData bits;
- };
-
- const FieldEntry* table() const {
- return reinterpret_cast<const FieldEntry*>(this + 1);
- }
- };
- #if defined(_MSC_VER) && !defined(_WIN64)
- #pragma warning(pop)
- #endif
- static_assert(sizeof(TailCallParseTableBase::FieldEntry) <= 16,
- "Field entry is too big.");
- template <size_t kTableSizeLog2>
- struct TailCallParseTable {
- TailCallParseTableBase header;
-
-
-
-
-
-
- TailCallParseTableBase::FieldEntry entries[(1 << kTableSizeLog2)];
- };
- static_assert(std::is_standard_layout<TailCallParseTable<1>>::value,
- "TailCallParseTable must be standard layout.");
- static_assert(offsetof(TailCallParseTable<1>, entries) ==
- sizeof(TailCallParseTableBase),
- "Table entries must be laid out after TailCallParseTableBase.");
- }
- }
- }
- #include <google/protobuf/port_undef.inc>
- #endif
|