MCPcopy Create free account
hub / github.com/DFHack/dfhack / ExpectTag

Method ExpectTag

depends/protobuf/google/protobuf/io/coded_stream.h:831–852  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

829}
830
831inline bool CodedInputStream::ExpectTag(uint32 expected) {
832 if (expected < (1 << 7)) {
833 if (GOOGLE_PREDICT_TRUE(buffer_ < buffer_end_) && buffer_[0] == expected) {
834 Advance(1);
835 return true;
836 } else {
837 return false;
838 }
839 } else if (expected < (1 << 14)) {
840 if (GOOGLE_PREDICT_TRUE(BufferSize() >= 2) &&
841 buffer_[0] == static_cast<uint8>(expected | 0x80) &&
842 buffer_[1] == static_cast<uint8>(expected >> 7)) {
843 Advance(2);
844 return true;
845 } else {
846 return false;
847 }
848 } else {
849 // Don't bother optimizing for larger values.
850 return false;
851 }
852}
853
854inline const uint8* CodedInputStream::ExpectTagFromArray(
855 const uint8* buffer, uint32 expected) {

Callers 3

ReadRepeatedPrimitiveMethod · 0.80

Calls

no outgoing calls

Tested by

no test coverage detected