// Generated by the protocol buffer compiler.  DO NOT EDIT!
// source: google/protobuf/util/message_differencer_unittest.proto

#include <google/protobuf/util/message_differencer_unittest.pb.h>

#include <algorithm>

#include <google/protobuf/stubs/common.h>
#include <google/protobuf/stubs/port.h>
#include <google/protobuf/io/coded_stream.h>
#include <google/protobuf/wire_format_lite_inl.h>
#include <google/protobuf/descriptor.h>
#include <google/protobuf/generated_message_reflection.h>
#include <google/protobuf/reflection_ops.h>
#include <google/protobuf/wire_format.h>
// This is a temporary google only hack
#ifdef GOOGLE_PROTOBUF_ENFORCE_UNIQUENESS
#include "third_party/protobuf/version.h"
#endif
// @@protoc_insertion_point(includes)

namespace protobuf_google_2fprotobuf_2futil_2fmessage_5fdifferencer_5funittest_2eproto {
extern PROTOBUF_INTERNAL_EXPORT_protobuf_google_2fprotobuf_2futil_2fmessage_5fdifferencer_5funittest_2eproto ::google::protobuf::internal::SCCInfo<0> scc_info_TestField;
extern PROTOBUF_INTERNAL_EXPORT_protobuf_google_2fprotobuf_2futil_2fmessage_5fdifferencer_5funittest_2eproto ::google::protobuf::internal::SCCInfo<1> scc_info_TestDiffMessage_Item;
}  // namespace protobuf_google_2fprotobuf_2futil_2fmessage_5fdifferencer_5funittest_2eproto
namespace protobuf_unittest {
class TestFieldDefaultTypeInternal {
 public:
  ::google::protobuf::internal::ExplicitlyConstructed<TestField>
      _instance;
} _TestField_default_instance_;
class TestDiffMessage_ItemDefaultTypeInternal {
 public:
  ::google::protobuf::internal::ExplicitlyConstructed<TestDiffMessage_Item>
      _instance;
} _TestDiffMessage_Item_default_instance_;
class TestDiffMessageDefaultTypeInternal {
 public:
  ::google::protobuf::internal::ExplicitlyConstructed<TestDiffMessage>
      _instance;
} _TestDiffMessage_default_instance_;
}  // namespace protobuf_unittest
namespace protobuf_google_2fprotobuf_2futil_2fmessage_5fdifferencer_5funittest_2eproto {
static void InitDefaultsTestField() {
  GOOGLE_PROTOBUF_VERIFY_VERSION;

  {
    void* ptr = &::protobuf_unittest::_TestField_default_instance_;
    new (ptr) ::protobuf_unittest::TestField();
    ::google::protobuf::internal::OnShutdownDestroyMessage(ptr);
  }
  ::protobuf_unittest::TestField::InitAsDefaultInstance();
}

::google::protobuf::internal::SCCInfo<0> scc_info_TestField =
    {{ATOMIC_VAR_INIT(::google::protobuf::internal::SCCInfoBase::kUninitialized), 0, InitDefaultsTestField}, {}};

static void InitDefaultsTestDiffMessage_Item() {
  GOOGLE_PROTOBUF_VERIFY_VERSION;

  {
    void* ptr = &::protobuf_unittest::_TestDiffMessage_Item_default_instance_;
    new (ptr) ::protobuf_unittest::TestDiffMessage_Item();
    ::google::protobuf::internal::OnShutdownDestroyMessage(ptr);
  }
  ::protobuf_unittest::TestDiffMessage_Item::InitAsDefaultInstance();
}

::google::protobuf::internal::SCCInfo<1> scc_info_TestDiffMessage_Item =
    {{ATOMIC_VAR_INIT(::google::protobuf::internal::SCCInfoBase::kUninitialized), 1, InitDefaultsTestDiffMessage_Item}, {
      &protobuf_google_2fprotobuf_2futil_2fmessage_5fdifferencer_5funittest_2eproto::scc_info_TestField.base,}};

static void InitDefaultsTestDiffMessage() {
  GOOGLE_PROTOBUF_VERIFY_VERSION;

  {
    void* ptr = &::protobuf_unittest::_TestDiffMessage_default_instance_;
    new (ptr) ::protobuf_unittest::TestDiffMessage();
    ::google::protobuf::internal::OnShutdownDestroyMessage(ptr);
  }
  ::protobuf_unittest::TestDiffMessage::InitAsDefaultInstance();
}

::google::protobuf::internal::SCCInfo<2> scc_info_TestDiffMessage =
    {{ATOMIC_VAR_INIT(::google::protobuf::internal::SCCInfoBase::kUninitialized), 2, InitDefaultsTestDiffMessage}, {
      &protobuf_google_2fprotobuf_2futil_2fmessage_5fdifferencer_5funittest_2eproto::scc_info_TestDiffMessage_Item.base,
      &protobuf_google_2fprotobuf_2futil_2fmessage_5fdifferencer_5funittest_2eproto::scc_info_TestField.base,}};

void InitDefaults() {
  ::google::protobuf::internal::InitSCC(&scc_info_TestField.base);
  ::google::protobuf::internal::InitSCC(&scc_info_TestDiffMessage_Item.base);
  ::google::protobuf::internal::InitSCC(&scc_info_TestDiffMessage.base);
}

::google::protobuf::Metadata file_level_metadata[3];

const ::google::protobuf::uint32 TableStruct::offsets[] GOOGLE_PROTOBUF_ATTRIBUTE_SECTION_VARIABLE(protodesc_cold) = {
  GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(::protobuf_unittest::TestField, _has_bits_),
  GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(::protobuf_unittest::TestField, _internal_metadata_),
  ~0u,  // no _extensions_
  ~0u,  // no _oneof_case_
  ~0u,  // no _weak_field_map_
  GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(::protobuf_unittest::TestField, a_),
  GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(::protobuf_unittest::TestField, b_),
  GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(::protobuf_unittest::TestField, c_),
  GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(::protobuf_unittest::TestField, rc_),
  GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(::protobuf_unittest::TestField, m_),
  2,
  3,
  1,
  ~0u,
  0,
  GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(::protobuf_unittest::TestDiffMessage_Item, _has_bits_),
  GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(::protobuf_unittest::TestDiffMessage_Item, _internal_metadata_),
  ~0u,  // no _extensions_
  ~0u,  // no _oneof_case_
  ~0u,  // no _weak_field_map_
  GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(::protobuf_unittest::TestDiffMessage_Item, a_),
  GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(::protobuf_unittest::TestDiffMessage_Item, b_),
  GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(::protobuf_unittest::TestDiffMessage_Item, ra_),
  GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(::protobuf_unittest::TestDiffMessage_Item, rb_),
  GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(::protobuf_unittest::TestDiffMessage_Item, m_),
  GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(::protobuf_unittest::TestDiffMessage_Item, rm_),
  2,
  0,
  ~0u,
  ~0u,
  1,
  ~0u,
  GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(::protobuf_unittest::TestDiffMessage, _has_bits_),
  GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(::protobuf_unittest::TestDiffMessage, _internal_metadata_),
  GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(::protobuf_unittest::TestDiffMessage, _extensions_),
  ~0u,  // no _oneof_case_
  ~0u,  // no _weak_field_map_
  GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(::protobuf_unittest::TestDiffMessage, item_),
  GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(::protobuf_unittest::TestDiffMessage, v_),
  GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(::protobuf_unittest::TestDiffMessage, w_),
  GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(::protobuf_unittest::TestDiffMessage, m_),
  GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(::protobuf_unittest::TestDiffMessage, rv_),
  GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(::protobuf_unittest::TestDiffMessage, rw_),
  GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(::protobuf_unittest::TestDiffMessage, rm_),
  ~0u,
  2,
  0,
  1,
  ~0u,
  ~0u,
  ~0u,
};
static const ::google::protobuf::internal::MigrationSchema schemas[] GOOGLE_PROTOBUF_ATTRIBUTE_SECTION_VARIABLE(protodesc_cold) = {
  { 0, 10, sizeof(::protobuf_unittest::TestField)},
  { 15, 26, sizeof(::protobuf_unittest::TestDiffMessage_Item)},
  { 32, 44, sizeof(::protobuf_unittest::TestDiffMessage)},
};

static ::google::protobuf::Message const * const file_default_instances[] = {
  reinterpret_cast<const ::google::protobuf::Message*>(&::protobuf_unittest::_TestField_default_instance_),
  reinterpret_cast<const ::google::protobuf::Message*>(&::protobuf_unittest::_TestDiffMessage_Item_default_instance_),
  reinterpret_cast<const ::google::protobuf::Message*>(&::protobuf_unittest::_TestDiffMessage_default_instance_),
};

void protobuf_AssignDescriptors() {
  AddDescriptors();
  AssignDescriptors(
      "google/protobuf/util/message_differencer_unittest.proto", schemas, file_default_instances, TableStruct::offsets,
      file_level_metadata, NULL, NULL);
}

void protobuf_AssignDescriptorsOnce() {
  static ::google::protobuf::internal::once_flag once;
  ::google::protobuf::internal::call_once(once, protobuf_AssignDescriptors);
}

void protobuf_RegisterTypes(const ::std::string&) GOOGLE_PROTOBUF_ATTRIBUTE_COLD;
void protobuf_RegisterTypes(const ::std::string&) {
  protobuf_AssignDescriptorsOnce();
  ::google::protobuf::internal::RegisterAllTypes(file_level_metadata, 3);
}

void AddDescriptorsImpl() {
  InitDefaults();
  static const char descriptor[] GOOGLE_PROTOBUF_ATTRIBUTE_SECTION_VARIABLE(protodesc_cold) = {
      "\n7google/protobuf/util/message_differenc"
      "er_unittest.proto\022\021protobuf_unittest\"\257\001\n"
      "\tTestField\022\t\n\001a\030\003 \001(\005\022\t\n\001b\030\004 \001(\005\022\t\n\001c\030\001 "
      "\001(\005\022\n\n\002rc\030\002 \003(\005\022\'\n\001m\030\005 \001(\0132\034.protobuf_un"
      "ittest.TestField2L\n\002tf\022\".protobuf_unitte"
      "st.TestDiffMessage\030d \001(\0132\034.protobuf_unit"
      "test.TestField\"\342\002\n\017TestDiffMessage\0225\n\004it"
      "em\030\001 \003(\n2\'.protobuf_unittest.TestDiffMes"
      "sage.Item\022\r\n\001v\030\r \001(\005B\002\030\001\022\t\n\001w\030\016 \001(\t\022\'\n\001m"
      "\030\017 \001(\0132\034.protobuf_unittest.TestField\022\n\n\002"
      "rv\030\013 \003(\005\022\n\n\002rw\030\n \003(\t\022,\n\002rm\030\014 \003(\0132\034.proto"
      "buf_unittest.TestFieldB\002\030\001\032\207\001\n\004Item\022\t\n\001a"
      "\030\002 \001(\005\022\t\n\001b\030\004 \001(\t\022\n\n\002ra\030\003 \003(\005\022\n\n\002rb\030\005 \003("
      "\t\022\'\n\001m\030\006 \001(\0132\034.protobuf_unittest.TestFie"
      "ld\022(\n\002rm\030\007 \003(\0132\034.protobuf_unittest.TestF"
      "ield*\005\010d\020\310\001B\002H\001"
  };
  ::google::protobuf::DescriptorPool::InternalAddGeneratedFile(
      descriptor, 615);
  ::google::protobuf::MessageFactory::InternalRegisterGeneratedFile(
    "google/protobuf/util/message_differencer_unittest.proto", &protobuf_RegisterTypes);
}

void AddDescriptors() {
  static ::google::protobuf::internal::once_flag once;
  ::google::protobuf::internal::call_once(once, AddDescriptorsImpl);
}
// Force AddDescriptors() to be called at dynamic initialization time.
struct StaticDescriptorInitializer {
  StaticDescriptorInitializer() {
    AddDescriptors();
  }
} static_descriptor_initializer;
}  // namespace protobuf_google_2fprotobuf_2futil_2fmessage_5fdifferencer_5funittest_2eproto
namespace protobuf_unittest {

// ===================================================================

void TestField::InitAsDefaultInstance() {
  ::protobuf_unittest::_TestField_default_instance_._instance.get_mutable()->m_ = const_cast< ::protobuf_unittest::TestField*>(
      ::protobuf_unittest::TestField::internal_default_instance());
}
#if !defined(_MSC_VER) || _MSC_VER >= 1900
const int TestField::kAFieldNumber;
const int TestField::kBFieldNumber;
const int TestField::kCFieldNumber;
const int TestField::kRcFieldNumber;
const int TestField::kMFieldNumber;
#endif  // !defined(_MSC_VER) || _MSC_VER >= 1900

TestField::TestField()
  : ::google::protobuf::Message(), _internal_metadata_(NULL) {
  ::google::protobuf::internal::InitSCC(
      &protobuf_google_2fprotobuf_2futil_2fmessage_5fdifferencer_5funittest_2eproto::scc_info_TestField.base);
  SharedCtor();
  // @@protoc_insertion_point(constructor:protobuf_unittest.TestField)
}
TestField::TestField(const TestField& from)
  : ::google::protobuf::Message(),
      _internal_metadata_(NULL),
      _has_bits_(from._has_bits_),
      rc_(from.rc_) {
  _internal_metadata_.MergeFrom(from._internal_metadata_);
  if (from.has_m()) {
    m_ = new ::protobuf_unittest::TestField(*from.m_);
  } else {
    m_ = NULL;
  }
  ::memcpy(&c_, &from.c_,
    static_cast<size_t>(reinterpret_cast<char*>(&b_) -
    reinterpret_cast<char*>(&c_)) + sizeof(b_));
  // @@protoc_insertion_point(copy_constructor:protobuf_unittest.TestField)
}

void TestField::SharedCtor() {
  ::memset(&m_, 0, static_cast<size_t>(
      reinterpret_cast<char*>(&b_) -
      reinterpret_cast<char*>(&m_)) + sizeof(b_));
}

TestField::~TestField() {
  // @@protoc_insertion_point(destructor:protobuf_unittest.TestField)
  SharedDtor();
}

void TestField::SharedDtor() {
  if (this != internal_default_instance()) delete m_;
}

void TestField::SetCachedSize(int size) const {
  _cached_size_.Set(size);
}
const ::google::protobuf::Descriptor* TestField::descriptor() {
  ::protobuf_google_2fprotobuf_2futil_2fmessage_5fdifferencer_5funittest_2eproto::protobuf_AssignDescriptorsOnce();
  return ::protobuf_google_2fprotobuf_2futil_2fmessage_5fdifferencer_5funittest_2eproto::file_level_metadata[kIndexInFileMessages].descriptor;
}

const TestField& TestField::default_instance() {
  ::google::protobuf::internal::InitSCC(&protobuf_google_2fprotobuf_2futil_2fmessage_5fdifferencer_5funittest_2eproto::scc_info_TestField.base);
  return *internal_default_instance();
}


void TestField::Clear() {
// @@protoc_insertion_point(message_clear_start:protobuf_unittest.TestField)
  ::google::protobuf::uint32 cached_has_bits = 0;
  // Prevent compiler warnings about cached_has_bits being unused
  (void) cached_has_bits;

  rc_.Clear();
  cached_has_bits = _has_bits_[0];
  if (cached_has_bits & 0x00000001u) {
    GOOGLE_DCHECK(m_ != NULL);
    m_->Clear();
  }
  if (cached_has_bits & 14u) {
    ::memset(&c_, 0, static_cast<size_t>(
        reinterpret_cast<char*>(&b_) -
        reinterpret_cast<char*>(&c_)) + sizeof(b_));
  }
  _has_bits_.Clear();
  _internal_metadata_.Clear();
}

bool TestField::MergePartialFromCodedStream(
    ::google::protobuf::io::CodedInputStream* input) {
#define DO_(EXPRESSION) if (!GOOGLE_PREDICT_TRUE(EXPRESSION)) goto failure
  ::google::protobuf::uint32 tag;
  // @@protoc_insertion_point(parse_start:protobuf_unittest.TestField)
  for (;;) {
    ::std::pair<::google::protobuf::uint32, bool> p = input->ReadTagWithCutoffNoLastTag(127u);
    tag = p.first;
    if (!p.second) goto handle_unusual;
    switch (::google::protobuf::internal::WireFormatLite::GetTagFieldNumber(tag)) {
      // optional int32 c = 1;
      case 1: {
        if (static_cast< ::google::protobuf::uint8>(tag) ==
            static_cast< ::google::protobuf::uint8>(8u /* 8 & 0xFF */)) {
          set_has_c();
          DO_((::google::protobuf::internal::WireFormatLite::ReadPrimitive<
                   ::google::protobuf::int32, ::google::protobuf::internal::WireFormatLite::TYPE_INT32>(
                 input, &c_)));
        } else {
          goto handle_unusual;
        }
        break;
      }

      // repeated int32 rc = 2;
      case 2: {
        if (static_cast< ::google::protobuf::uint8>(tag) ==
            static_cast< ::google::protobuf::uint8>(16u /* 16 & 0xFF */)) {
          DO_((::google::protobuf::internal::WireFormatLite::ReadRepeatedPrimitive<
                   ::google::protobuf::int32, ::google::protobuf::internal::WireFormatLite::TYPE_INT32>(
                 1, 16u, input, this->mutable_rc())));
        } else if (
            static_cast< ::google::protobuf::uint8>(tag) ==
            static_cast< ::google::protobuf::uint8>(18u /* 18 & 0xFF */)) {
          DO_((::google::protobuf::internal::WireFormatLite::ReadPackedPrimitiveNoInline<
                   ::google::protobuf::int32, ::google::protobuf::internal::WireFormatLite::TYPE_INT32>(
                 input, this->mutable_rc())));
        } else {
          goto handle_unusual;
        }
        break;
      }

      // optional int32 a = 3;
      case 3: {
        if (static_cast< ::google::protobuf::uint8>(tag) ==
            static_cast< ::google::protobuf::uint8>(24u /* 24 & 0xFF */)) {
          set_has_a();
          DO_((::google::protobuf::internal::WireFormatLite::ReadPrimitive<
                   ::google::protobuf::int32, ::google::protobuf::internal::WireFormatLite::TYPE_INT32>(
                 input, &a_)));
        } else {
          goto handle_unusual;
        }
        break;
      }

      // optional int32 b = 4;
      case 4: {
        if (static_cast< ::google::protobuf::uint8>(tag) ==
            static_cast< ::google::protobuf::uint8>(32u /* 32 & 0xFF */)) {
          set_has_b();
          DO_((::google::protobuf::internal::WireFormatLite::ReadPrimitive<
                   ::google::protobuf::int32, ::google::protobuf::internal::WireFormatLite::TYPE_INT32>(
                 input, &b_)));
        } else {
          goto handle_unusual;
        }
        break;
      }

      // optional .protobuf_unittest.TestField m = 5;
      case 5: {
        if (static_cast< ::google::protobuf::uint8>(tag) ==
            static_cast< ::google::protobuf::uint8>(42u /* 42 & 0xFF */)) {
          DO_(::google::protobuf::internal::WireFormatLite::ReadMessage(
               input, mutable_m()));
        } else {
          goto handle_unusual;
        }
        break;
      }

      default: {
      handle_unusual:
        if (tag == 0) {
          goto success;
        }
        DO_(::google::protobuf::internal::WireFormat::SkipField(
              input, tag, _internal_metadata_.mutable_unknown_fields()));
        break;
      }
    }
  }
success:
  // @@protoc_insertion_point(parse_success:protobuf_unittest.TestField)
  return true;
failure:
  // @@protoc_insertion_point(parse_failure:protobuf_unittest.TestField)
  return false;
#undef DO_
}

void TestField::SerializeWithCachedSizes(
    ::google::protobuf::io::CodedOutputStream* output) const {
  // @@protoc_insertion_point(serialize_start:protobuf_unittest.TestField)
  ::google::protobuf::uint32 cached_has_bits = 0;
  (void) cached_has_bits;

  cached_has_bits = _has_bits_[0];
  // optional int32 c = 1;
  if (cached_has_bits & 0x00000002u) {
    ::google::protobuf::internal::WireFormatLite::WriteInt32(1, this->c(), output);
  }

  // repeated int32 rc = 2;
  for (int i = 0, n = this->rc_size(); i < n; i++) {
    ::google::protobuf::internal::WireFormatLite::WriteInt32(
      2, this->rc(i), output);
  }

  // optional int32 a = 3;
  if (cached_has_bits & 0x00000004u) {
    ::google::protobuf::internal::WireFormatLite::WriteInt32(3, this->a(), output);
  }

  // optional int32 b = 4;
  if (cached_has_bits & 0x00000008u) {
    ::google::protobuf::internal::WireFormatLite::WriteInt32(4, this->b(), output);
  }

  // optional .protobuf_unittest.TestField m = 5;
  if (cached_has_bits & 0x00000001u) {
    ::google::protobuf::internal::WireFormatLite::WriteMessageMaybeToArray(
      5, this->_internal_m(), output);
  }

  if (_internal_metadata_.have_unknown_fields()) {
    ::google::protobuf::internal::WireFormat::SerializeUnknownFields(
        _internal_metadata_.unknown_fields(), output);
  }
  // @@protoc_insertion_point(serialize_end:protobuf_unittest.TestField)
}

::google::protobuf::uint8* TestField::InternalSerializeWithCachedSizesToArray(
    bool deterministic, ::google::protobuf::uint8* target) const {
  (void)deterministic; // Unused
  // @@protoc_insertion_point(serialize_to_array_start:protobuf_unittest.TestField)
  ::google::protobuf::uint32 cached_has_bits = 0;
  (void) cached_has_bits;

  cached_has_bits = _has_bits_[0];
  // optional int32 c = 1;
  if (cached_has_bits & 0x00000002u) {
    target = ::google::protobuf::internal::WireFormatLite::WriteInt32ToArray(1, this->c(), target);
  }

  // repeated int32 rc = 2;
  target = ::google::protobuf::internal::WireFormatLite::
    WriteInt32ToArray(2, this->rc_, target);

  // optional int32 a = 3;
  if (cached_has_bits & 0x00000004u) {
    target = ::google::protobuf::internal::WireFormatLite::WriteInt32ToArray(3, this->a(), target);
  }

  // optional int32 b = 4;
  if (cached_has_bits & 0x00000008u) {
    target = ::google::protobuf::internal::WireFormatLite::WriteInt32ToArray(4, this->b(), target);
  }

  // optional .protobuf_unittest.TestField m = 5;
  if (cached_has_bits & 0x00000001u) {
    target = ::google::protobuf::internal::WireFormatLite::
      InternalWriteMessageToArray(
        5, this->_internal_m(), deterministic, target);
  }

  if (_internal_metadata_.have_unknown_fields()) {
    target = ::google::protobuf::internal::WireFormat::SerializeUnknownFieldsToArray(
        _internal_metadata_.unknown_fields(), target);
  }
  // @@protoc_insertion_point(serialize_to_array_end:protobuf_unittest.TestField)
  return target;
}

size_t TestField::ByteSizeLong() const {
// @@protoc_insertion_point(message_byte_size_start:protobuf_unittest.TestField)
  size_t total_size = 0;

  if (_internal_metadata_.have_unknown_fields()) {
    total_size +=
      ::google::protobuf::internal::WireFormat::ComputeUnknownFieldsSize(
        _internal_metadata_.unknown_fields());
  }
  // repeated int32 rc = 2;
  {
    size_t data_size = ::google::protobuf::internal::WireFormatLite::
      Int32Size(this->rc_);
    total_size += 1 *
                  ::google::protobuf::internal::FromIntSize(this->rc_size());
    total_size += data_size;
  }

  if (_has_bits_[0 / 32] & 15u) {
    // optional .protobuf_unittest.TestField m = 5;
    if (has_m()) {
      total_size += 1 +
        ::google::protobuf::internal::WireFormatLite::MessageSize(
          *m_);
    }

    // optional int32 c = 1;
    if (has_c()) {
      total_size += 1 +
        ::google::protobuf::internal::WireFormatLite::Int32Size(
          this->c());
    }

    // optional int32 a = 3;
    if (has_a()) {
      total_size += 1 +
        ::google::protobuf::internal::WireFormatLite::Int32Size(
          this->a());
    }

    // optional int32 b = 4;
    if (has_b()) {
      total_size += 1 +
        ::google::protobuf::internal::WireFormatLite::Int32Size(
          this->b());
    }

  }
  int cached_size = ::google::protobuf::internal::ToCachedSize(total_size);
  SetCachedSize(cached_size);
  return total_size;
}

void TestField::MergeFrom(const ::google::protobuf::Message& from) {
// @@protoc_insertion_point(generalized_merge_from_start:protobuf_unittest.TestField)
  GOOGLE_DCHECK_NE(&from, this);
  const TestField* source =
      ::google::protobuf::internal::DynamicCastToGenerated<const TestField>(
          &from);
  if (source == NULL) {
  // @@protoc_insertion_point(generalized_merge_from_cast_fail:protobuf_unittest.TestField)
    ::google::protobuf::internal::ReflectionOps::Merge(from, this);
  } else {
  // @@protoc_insertion_point(generalized_merge_from_cast_success:protobuf_unittest.TestField)
    MergeFrom(*source);
  }
}

void TestField::MergeFrom(const TestField& from) {
// @@protoc_insertion_point(class_specific_merge_from_start:protobuf_unittest.TestField)
  GOOGLE_DCHECK_NE(&from, this);
  _internal_metadata_.MergeFrom(from._internal_metadata_);
  ::google::protobuf::uint32 cached_has_bits = 0;
  (void) cached_has_bits;

  rc_.MergeFrom(from.rc_);
  cached_has_bits = from._has_bits_[0];
  if (cached_has_bits & 15u) {
    if (cached_has_bits & 0x00000001u) {
      mutable_m()->::protobuf_unittest::TestField::MergeFrom(from.m());
    }
    if (cached_has_bits & 0x00000002u) {
      c_ = from.c_;
    }
    if (cached_has_bits & 0x00000004u) {
      a_ = from.a_;
    }
    if (cached_has_bits & 0x00000008u) {
      b_ = from.b_;
    }
    _has_bits_[0] |= cached_has_bits;
  }
}

void TestField::CopyFrom(const ::google::protobuf::Message& from) {
// @@protoc_insertion_point(generalized_copy_from_start:protobuf_unittest.TestField)
  if (&from == this) return;
  Clear();
  MergeFrom(from);
}

void TestField::CopyFrom(const TestField& from) {
// @@protoc_insertion_point(class_specific_copy_from_start:protobuf_unittest.TestField)
  if (&from == this) return;
  Clear();
  MergeFrom(from);
}

bool TestField::IsInitialized() const {
  return true;
}

void TestField::Swap(TestField* other) {
  if (other == this) return;
  InternalSwap(other);
}
void TestField::InternalSwap(TestField* other) {
  using std::swap;
  rc_.InternalSwap(&other->rc_);
  swap(m_, other->m_);
  swap(c_, other->c_);
  swap(a_, other->a_);
  swap(b_, other->b_);
  swap(_has_bits_[0], other->_has_bits_[0]);
  _internal_metadata_.Swap(&other->_internal_metadata_);
}

::google::protobuf::Metadata TestField::GetMetadata() const {
  protobuf_google_2fprotobuf_2futil_2fmessage_5fdifferencer_5funittest_2eproto::protobuf_AssignDescriptorsOnce();
  return ::protobuf_google_2fprotobuf_2futil_2fmessage_5fdifferencer_5funittest_2eproto::file_level_metadata[kIndexInFileMessages];
}


// ===================================================================

void TestDiffMessage_Item::InitAsDefaultInstance() {
  ::protobuf_unittest::_TestDiffMessage_Item_default_instance_._instance.get_mutable()->m_ = const_cast< ::protobuf_unittest::TestField*>(
      ::protobuf_unittest::TestField::internal_default_instance());
}
#if !defined(_MSC_VER) || _MSC_VER >= 1900
const int TestDiffMessage_Item::kAFieldNumber;
const int TestDiffMessage_Item::kBFieldNumber;
const int TestDiffMessage_Item::kRaFieldNumber;
const int TestDiffMessage_Item::kRbFieldNumber;
const int TestDiffMessage_Item::kMFieldNumber;
const int TestDiffMessage_Item::kRmFieldNumber;
#endif  // !defined(_MSC_VER) || _MSC_VER >= 1900

TestDiffMessage_Item::TestDiffMessage_Item()
  : ::google::protobuf::Message(), _internal_metadata_(NULL) {
  ::google::protobuf::internal::InitSCC(
      &protobuf_google_2fprotobuf_2futil_2fmessage_5fdifferencer_5funittest_2eproto::scc_info_TestDiffMessage_Item.base);
  SharedCtor();
  // @@protoc_insertion_point(constructor:protobuf_unittest.TestDiffMessage.Item)
}
TestDiffMessage_Item::TestDiffMessage_Item(const TestDiffMessage_Item& from)
  : ::google::protobuf::Message(),
      _internal_metadata_(NULL),
      _has_bits_(from._has_bits_),
      ra_(from.ra_),
      rb_(from.rb_),
      rm_(from.rm_) {
  _internal_metadata_.MergeFrom(from._internal_metadata_);
  b_.UnsafeSetDefault(&::google::protobuf::internal::GetEmptyStringAlreadyInited());
  if (from.has_b()) {
    b_.AssignWithDefault(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), from.b_);
  }
  if (from.has_m()) {
    m_ = new ::protobuf_unittest::TestField(*from.m_);
  } else {
    m_ = NULL;
  }
  a_ = from.a_;
  // @@protoc_insertion_point(copy_constructor:protobuf_unittest.TestDiffMessage.Item)
}

void TestDiffMessage_Item::SharedCtor() {
  b_.UnsafeSetDefault(&::google::protobuf::internal::GetEmptyStringAlreadyInited());
  ::memset(&m_, 0, static_cast<size_t>(
      reinterpret_cast<char*>(&a_) -
      reinterpret_cast<char*>(&m_)) + sizeof(a_));
}

TestDiffMessage_Item::~TestDiffMessage_Item() {
  // @@protoc_insertion_point(destructor:protobuf_unittest.TestDiffMessage.Item)
  SharedDtor();
}

void TestDiffMessage_Item::SharedDtor() {
  b_.DestroyNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited());
  if (this != internal_default_instance()) delete m_;
}

void TestDiffMessage_Item::SetCachedSize(int size) const {
  _cached_size_.Set(size);
}
const ::google::protobuf::Descriptor* TestDiffMessage_Item::descriptor() {
  ::protobuf_google_2fprotobuf_2futil_2fmessage_5fdifferencer_5funittest_2eproto::protobuf_AssignDescriptorsOnce();
  return ::protobuf_google_2fprotobuf_2futil_2fmessage_5fdifferencer_5funittest_2eproto::file_level_metadata[kIndexInFileMessages].descriptor;
}

const TestDiffMessage_Item& TestDiffMessage_Item::default_instance() {
  ::google::protobuf::internal::InitSCC(&protobuf_google_2fprotobuf_2futil_2fmessage_5fdifferencer_5funittest_2eproto::scc_info_TestDiffMessage_Item.base);
  return *internal_default_instance();
}


void TestDiffMessage_Item::Clear() {
// @@protoc_insertion_point(message_clear_start:protobuf_unittest.TestDiffMessage.Item)
  ::google::protobuf::uint32 cached_has_bits = 0;
  // Prevent compiler warnings about cached_has_bits being unused
  (void) cached_has_bits;

  ra_.Clear();
  rb_.Clear();
  rm_.Clear();
  cached_has_bits = _has_bits_[0];
  if (cached_has_bits & 3u) {
    if (cached_has_bits & 0x00000001u) {
      b_.ClearNonDefaultToEmptyNoArena();
    }
    if (cached_has_bits & 0x00000002u) {
      GOOGLE_DCHECK(m_ != NULL);
      m_->Clear();
    }
  }
  a_ = 0;
  _has_bits_.Clear();
  _internal_metadata_.Clear();
}

bool TestDiffMessage_Item::MergePartialFromCodedStream(
    ::google::protobuf::io::CodedInputStream* input) {
#define DO_(EXPRESSION) if (!GOOGLE_PREDICT_TRUE(EXPRESSION)) goto failure
  ::google::protobuf::uint32 tag;
  // @@protoc_insertion_point(parse_start:protobuf_unittest.TestDiffMessage.Item)
  for (;;) {
    ::std::pair<::google::protobuf::uint32, bool> p = input->ReadTagWithCutoffNoLastTag(127u);
    tag = p.first;
    if (!p.second) goto handle_unusual;
    switch (::google::protobuf::internal::WireFormatLite::GetTagFieldNumber(tag)) {
      // optional int32 a = 2;
      case 2: {
        if (static_cast< ::google::protobuf::uint8>(tag) ==
            static_cast< ::google::protobuf::uint8>(16u /* 16 & 0xFF */)) {
          set_has_a();
          DO_((::google::protobuf::internal::WireFormatLite::ReadPrimitive<
                   ::google::protobuf::int32, ::google::protobuf::internal::WireFormatLite::TYPE_INT32>(
                 input, &a_)));
        } else {
          goto handle_unusual;
        }
        break;
      }

      // repeated int32 ra = 3;
      case 3: {
        if (static_cast< ::google::protobuf::uint8>(tag) ==
            static_cast< ::google::protobuf::uint8>(24u /* 24 & 0xFF */)) {
          DO_((::google::protobuf::internal::WireFormatLite::ReadRepeatedPrimitive<
                   ::google::protobuf::int32, ::google::protobuf::internal::WireFormatLite::TYPE_INT32>(
                 1, 24u, input, this->mutable_ra())));
        } else if (
            static_cast< ::google::protobuf::uint8>(tag) ==
            static_cast< ::google::protobuf::uint8>(26u /* 26 & 0xFF */)) {
          DO_((::google::protobuf::internal::WireFormatLite::ReadPackedPrimitiveNoInline<
                   ::google::protobuf::int32, ::google::protobuf::internal::WireFormatLite::TYPE_INT32>(
                 input, this->mutable_ra())));
        } else {
          goto handle_unusual;
        }
        break;
      }

      // optional string b = 4;
      case 4: {
        if (static_cast< ::google::protobuf::uint8>(tag) ==
            static_cast< ::google::protobuf::uint8>(34u /* 34 & 0xFF */)) {
          DO_(::google::protobuf::internal::WireFormatLite::ReadString(
                input, this->mutable_b()));
          ::google::protobuf::internal::WireFormat::VerifyUTF8StringNamedField(
            this->b().data(), static_cast<int>(this->b().length()),
            ::google::protobuf::internal::WireFormat::PARSE,
            "protobuf_unittest.TestDiffMessage.Item.b");
        } else {
          goto handle_unusual;
        }
        break;
      }

      // repeated string rb = 5;
      case 5: {
        if (static_cast< ::google::protobuf::uint8>(tag) ==
            static_cast< ::google::protobuf::uint8>(42u /* 42 & 0xFF */)) {
          DO_(::google::protobuf::internal::WireFormatLite::ReadString(
                input, this->add_rb()));
          ::google::protobuf::internal::WireFormat::VerifyUTF8StringNamedField(
            this->rb(this->rb_size() - 1).data(),
            static_cast<int>(this->rb(this->rb_size() - 1).length()),
            ::google::protobuf::internal::WireFormat::PARSE,
            "protobuf_unittest.TestDiffMessage.Item.rb");
        } else {
          goto handle_unusual;
        }
        break;
      }

      // optional .protobuf_unittest.TestField m = 6;
      case 6: {
        if (static_cast< ::google::protobuf::uint8>(tag) ==
            static_cast< ::google::protobuf::uint8>(50u /* 50 & 0xFF */)) {
          DO_(::google::protobuf::internal::WireFormatLite::ReadMessage(
               input, mutable_m()));
        } else {
          goto handle_unusual;
        }
        break;
      }

      // repeated .protobuf_unittest.TestField rm = 7;
      case 7: {
        if (static_cast< ::google::protobuf::uint8>(tag) ==
            static_cast< ::google::protobuf::uint8>(58u /* 58 & 0xFF */)) {
          DO_(::google::protobuf::internal::WireFormatLite::ReadMessage(
                input, add_rm()));
        } else {
          goto handle_unusual;
        }
        break;
      }

      default: {
      handle_unusual:
        if (tag == 0 ||
            ::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) ==
            ::google::protobuf::internal::WireFormatLite::WIRETYPE_END_GROUP) {
          input->SetLastTag(tag);
          goto success;
        }
        DO_(::google::protobuf::internal::WireFormat::SkipField(
              input, tag, _internal_metadata_.mutable_unknown_fields()));
        break;
      }
    }
  }
success:
  // @@protoc_insertion_point(parse_success:protobuf_unittest.TestDiffMessage.Item)
  return true;
failure:
  // @@protoc_insertion_point(parse_failure:protobuf_unittest.TestDiffMessage.Item)
  return false;
#undef DO_
}

void TestDiffMessage_Item::SerializeWithCachedSizes(
    ::google::protobuf::io::CodedOutputStream* output) const {
  // @@protoc_insertion_point(serialize_start:protobuf_unittest.TestDiffMessage.Item)
  ::google::protobuf::uint32 cached_has_bits = 0;
  (void) cached_has_bits;

  cached_has_bits = _has_bits_[0];
  // optional int32 a = 2;
  if (cached_has_bits & 0x00000004u) {
    ::google::protobuf::internal::WireFormatLite::WriteInt32(2, this->a(), output);
  }

  // repeated int32 ra = 3;
  for (int i = 0, n = this->ra_size(); i < n; i++) {
    ::google::protobuf::internal::WireFormatLite::WriteInt32(
      3, this->ra(i), output);
  }

  // optional string b = 4;
  if (cached_has_bits & 0x00000001u) {
    ::google::protobuf::internal::WireFormat::VerifyUTF8StringNamedField(
      this->b().data(), static_cast<int>(this->b().length()),
      ::google::protobuf::internal::WireFormat::SERIALIZE,
      "protobuf_unittest.TestDiffMessage.Item.b");
    ::google::protobuf::internal::WireFormatLite::WriteStringMaybeAliased(
      4, this->b(), output);
  }

  // repeated string rb = 5;
  for (int i = 0, n = this->rb_size(); i < n; i++) {
    ::google::protobuf::internal::WireFormat::VerifyUTF8StringNamedField(
      this->rb(i).data(), static_cast<int>(this->rb(i).length()),
      ::google::protobuf::internal::WireFormat::SERIALIZE,
      "protobuf_unittest.TestDiffMessage.Item.rb");
    ::google::protobuf::internal::WireFormatLite::WriteString(
      5, this->rb(i), output);
  }

  // optional .protobuf_unittest.TestField m = 6;
  if (cached_has_bits & 0x00000002u) {
    ::google::protobuf::internal::WireFormatLite::WriteMessageMaybeToArray(
      6, this->_internal_m(), output);
  }

  // repeated .protobuf_unittest.TestField rm = 7;
  for (unsigned int i = 0,
      n = static_cast<unsigned int>(this->rm_size()); i < n; i++) {
    ::google::protobuf::internal::WireFormatLite::WriteMessageMaybeToArray(
      7,
      this->rm(static_cast<int>(i)),
      output);
  }

  if (_internal_metadata_.have_unknown_fields()) {
    ::google::protobuf::internal::WireFormat::SerializeUnknownFields(
        _internal_metadata_.unknown_fields(), output);
  }
  // @@protoc_insertion_point(serialize_end:protobuf_unittest.TestDiffMessage.Item)
}

::google::protobuf::uint8* TestDiffMessage_Item::InternalSerializeWithCachedSizesToArray(
    bool deterministic, ::google::protobuf::uint8* target) const {
  (void)deterministic; // Unused
  // @@protoc_insertion_point(serialize_to_array_start:protobuf_unittest.TestDiffMessage.Item)
  ::google::protobuf::uint32 cached_has_bits = 0;
  (void) cached_has_bits;

  cached_has_bits = _has_bits_[0];
  // optional int32 a = 2;
  if (cached_has_bits & 0x00000004u) {
    target = ::google::protobuf::internal::WireFormatLite::WriteInt32ToArray(2, this->a(), target);
  }

  // repeated int32 ra = 3;
  target = ::google::protobuf::internal::WireFormatLite::
    WriteInt32ToArray(3, this->ra_, target);

  // optional string b = 4;
  if (cached_has_bits & 0x00000001u) {
    ::google::protobuf::internal::WireFormat::VerifyUTF8StringNamedField(
      this->b().data(), static_cast<int>(this->b().length()),
      ::google::protobuf::internal::WireFormat::SERIALIZE,
      "protobuf_unittest.TestDiffMessage.Item.b");
    target =
      ::google::protobuf::internal::WireFormatLite::WriteStringToArray(
        4, this->b(), target);
  }

  // repeated string rb = 5;
  for (int i = 0, n = this->rb_size(); i < n; i++) {
    ::google::protobuf::internal::WireFormat::VerifyUTF8StringNamedField(
      this->rb(i).data(), static_cast<int>(this->rb(i).length()),
      ::google::protobuf::internal::WireFormat::SERIALIZE,
      "protobuf_unittest.TestDiffMessage.Item.rb");
    target = ::google::protobuf::internal::WireFormatLite::
      WriteStringToArray(5, this->rb(i), target);
  }

  // optional .protobuf_unittest.TestField m = 6;
  if (cached_has_bits & 0x00000002u) {
    target = ::google::protobuf::internal::WireFormatLite::
      InternalWriteMessageToArray(
        6, this->_internal_m(), deterministic, target);
  }

  // repeated .protobuf_unittest.TestField rm = 7;
  for (unsigned int i = 0,
      n = static_cast<unsigned int>(this->rm_size()); i < n; i++) {
    target = ::google::protobuf::internal::WireFormatLite::
      InternalWriteMessageToArray(
        7, this->rm(static_cast<int>(i)), deterministic, target);
  }

  if (_internal_metadata_.have_unknown_fields()) {
    target = ::google::protobuf::internal::WireFormat::SerializeUnknownFieldsToArray(
        _internal_metadata_.unknown_fields(), target);
  }
  // @@protoc_insertion_point(serialize_to_array_end:protobuf_unittest.TestDiffMessage.Item)
  return target;
}

size_t TestDiffMessage_Item::ByteSizeLong() const {
// @@protoc_insertion_point(message_byte_size_start:protobuf_unittest.TestDiffMessage.Item)
  size_t total_size = 0;

  if (_internal_metadata_.have_unknown_fields()) {
    total_size +=
      ::google::protobuf::internal::WireFormat::ComputeUnknownFieldsSize(
        _internal_metadata_.unknown_fields());
  }
  // repeated int32 ra = 3;
  {
    size_t data_size = ::google::protobuf::internal::WireFormatLite::
      Int32Size(this->ra_);
    total_size += 1 *
                  ::google::protobuf::internal::FromIntSize(this->ra_size());
    total_size += data_size;
  }

  // repeated string rb = 5;
  total_size += 1 *
      ::google::protobuf::internal::FromIntSize(this->rb_size());
  for (int i = 0, n = this->rb_size(); i < n; i++) {
    total_size += ::google::protobuf::internal::WireFormatLite::StringSize(
      this->rb(i));
  }

  // repeated .protobuf_unittest.TestField rm = 7;
  {
    unsigned int count = static_cast<unsigned int>(this->rm_size());
    total_size += 1UL * count;
    for (unsigned int i = 0; i < count; i++) {
      total_size +=
        ::google::protobuf::internal::WireFormatLite::MessageSize(
          this->rm(static_cast<int>(i)));
    }
  }

  if (_has_bits_[0 / 32] & 7u) {
    // optional string b = 4;
    if (has_b()) {
      total_size += 1 +
        ::google::protobuf::internal::WireFormatLite::StringSize(
          this->b());
    }

    // optional .protobuf_unittest.TestField m = 6;
    if (has_m()) {
      total_size += 1 +
        ::google::protobuf::internal::WireFormatLite::MessageSize(
          *m_);
    }

    // optional int32 a = 2;
    if (has_a()) {
      total_size += 1 +
        ::google::protobuf::internal::WireFormatLite::Int32Size(
          this->a());
    }

  }
  int cached_size = ::google::protobuf::internal::ToCachedSize(total_size);
  SetCachedSize(cached_size);
  return total_size;
}

void TestDiffMessage_Item::MergeFrom(const ::google::protobuf::Message& from) {
// @@protoc_insertion_point(generalized_merge_from_start:protobuf_unittest.TestDiffMessage.Item)
  GOOGLE_DCHECK_NE(&from, this);
  const TestDiffMessage_Item* source =
      ::google::protobuf::internal::DynamicCastToGenerated<const TestDiffMessage_Item>(
          &from);
  if (source == NULL) {
  // @@protoc_insertion_point(generalized_merge_from_cast_fail:protobuf_unittest.TestDiffMessage.Item)
    ::google::protobuf::internal::ReflectionOps::Merge(from, this);
  } else {
  // @@protoc_insertion_point(generalized_merge_from_cast_success:protobuf_unittest.TestDiffMessage.Item)
    MergeFrom(*source);
  }
}

void TestDiffMessage_Item::MergeFrom(const TestDiffMessage_Item& from) {
// @@protoc_insertion_point(class_specific_merge_from_start:protobuf_unittest.TestDiffMessage.Item)
  GOOGLE_DCHECK_NE(&from, this);
  _internal_metadata_.MergeFrom(from._internal_metadata_);
  ::google::protobuf::uint32 cached_has_bits = 0;
  (void) cached_has_bits;

  ra_.MergeFrom(from.ra_);
  rb_.MergeFrom(from.rb_);
  rm_.MergeFrom(from.rm_);
  cached_has_bits = from._has_bits_[0];
  if (cached_has_bits & 7u) {
    if (cached_has_bits & 0x00000001u) {
      set_has_b();
      b_.AssignWithDefault(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), from.b_);
    }
    if (cached_has_bits & 0x00000002u) {
      mutable_m()->::protobuf_unittest::TestField::MergeFrom(from.m());
    }
    if (cached_has_bits & 0x00000004u) {
      a_ = from.a_;
    }
    _has_bits_[0] |= cached_has_bits;
  }
}

void TestDiffMessage_Item::CopyFrom(const ::google::protobuf::Message& from) {
// @@protoc_insertion_point(generalized_copy_from_start:protobuf_unittest.TestDiffMessage.Item)
  if (&from == this) return;
  Clear();
  MergeFrom(from);
}

void TestDiffMessage_Item::CopyFrom(const TestDiffMessage_Item& from) {
// @@protoc_insertion_point(class_specific_copy_from_start:protobuf_unittest.TestDiffMessage.Item)
  if (&from == this) return;
  Clear();
  MergeFrom(from);
}

bool TestDiffMessage_Item::IsInitialized() const {
  return true;
}

void TestDiffMessage_Item::Swap(TestDiffMessage_Item* other) {
  if (other == this) return;
  InternalSwap(other);
}
void TestDiffMessage_Item::InternalSwap(TestDiffMessage_Item* other) {
  using std::swap;
  ra_.InternalSwap(&other->ra_);
  rb_.InternalSwap(CastToBase(&other->rb_));
  CastToBase(&rm_)->InternalSwap(CastToBase(&other->rm_));
  b_.Swap(&other->b_, &::google::protobuf::internal::GetEmptyStringAlreadyInited(),
    GetArenaNoVirtual());
  swap(m_, other->m_);
  swap(a_, other->a_);
  swap(_has_bits_[0], other->_has_bits_[0]);
  _internal_metadata_.Swap(&other->_internal_metadata_);
}

::google::protobuf::Metadata TestDiffMessage_Item::GetMetadata() const {
  protobuf_google_2fprotobuf_2futil_2fmessage_5fdifferencer_5funittest_2eproto::protobuf_AssignDescriptorsOnce();
  return ::protobuf_google_2fprotobuf_2futil_2fmessage_5fdifferencer_5funittest_2eproto::file_level_metadata[kIndexInFileMessages];
}


// ===================================================================

void TestDiffMessage::InitAsDefaultInstance() {
  ::protobuf_unittest::_TestDiffMessage_default_instance_._instance.get_mutable()->m_ = const_cast< ::protobuf_unittest::TestField*>(
      ::protobuf_unittest::TestField::internal_default_instance());
}
#if !defined(_MSC_VER) || _MSC_VER >= 1900
const int TestDiffMessage::kItemFieldNumber;
const int TestDiffMessage::kVFieldNumber;
const int TestDiffMessage::kWFieldNumber;
const int TestDiffMessage::kMFieldNumber;
const int TestDiffMessage::kRvFieldNumber;
const int TestDiffMessage::kRwFieldNumber;
const int TestDiffMessage::kRmFieldNumber;
#endif  // !defined(_MSC_VER) || _MSC_VER >= 1900

TestDiffMessage::TestDiffMessage()
  : ::google::protobuf::Message(), _internal_metadata_(NULL) {
  ::google::protobuf::internal::InitSCC(
      &protobuf_google_2fprotobuf_2futil_2fmessage_5fdifferencer_5funittest_2eproto::scc_info_TestDiffMessage.base);
  SharedCtor();
  // @@protoc_insertion_point(constructor:protobuf_unittest.TestDiffMessage)
}
TestDiffMessage::TestDiffMessage(const TestDiffMessage& from)
  : ::google::protobuf::Message(),
      _internal_metadata_(NULL),
      _has_bits_(from._has_bits_),
      item_(from.item_),
      rw_(from.rw_),
      rv_(from.rv_),
      rm_(from.rm_) {
  _internal_metadata_.MergeFrom(from._internal_metadata_);
  _extensions_.MergeFrom(from._extensions_);
  w_.UnsafeSetDefault(&::google::protobuf::internal::GetEmptyStringAlreadyInited());
  if (from.has_w()) {
    w_.AssignWithDefault(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), from.w_);
  }
  if (from.has_m()) {
    m_ = new ::protobuf_unittest::TestField(*from.m_);
  } else {
    m_ = NULL;
  }
  v_ = from.v_;
  // @@protoc_insertion_point(copy_constructor:protobuf_unittest.TestDiffMessage)
}

void TestDiffMessage::SharedCtor() {
  w_.UnsafeSetDefault(&::google::protobuf::internal::GetEmptyStringAlreadyInited());
  ::memset(&m_, 0, static_cast<size_t>(
      reinterpret_cast<char*>(&v_) -
      reinterpret_cast<char*>(&m_)) + sizeof(v_));
}

TestDiffMessage::~TestDiffMessage() {
  // @@protoc_insertion_point(destructor:protobuf_unittest.TestDiffMessage)
  SharedDtor();
}

void TestDiffMessage::SharedDtor() {
  w_.DestroyNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited());
  if (this != internal_default_instance()) delete m_;
}

void TestDiffMessage::SetCachedSize(int size) const {
  _cached_size_.Set(size);
}
const ::google::protobuf::Descriptor* TestDiffMessage::descriptor() {
  ::protobuf_google_2fprotobuf_2futil_2fmessage_5fdifferencer_5funittest_2eproto::protobuf_AssignDescriptorsOnce();
  return ::protobuf_google_2fprotobuf_2futil_2fmessage_5fdifferencer_5funittest_2eproto::file_level_metadata[kIndexInFileMessages].descriptor;
}

const TestDiffMessage& TestDiffMessage::default_instance() {
  ::google::protobuf::internal::InitSCC(&protobuf_google_2fprotobuf_2futil_2fmessage_5fdifferencer_5funittest_2eproto::scc_info_TestDiffMessage.base);
  return *internal_default_instance();
}


void TestDiffMessage::Clear() {
// @@protoc_insertion_point(message_clear_start:protobuf_unittest.TestDiffMessage)
  ::google::protobuf::uint32 cached_has_bits = 0;
  // Prevent compiler warnings about cached_has_bits being unused
  (void) cached_has_bits;

  _extensions_.Clear();
  item_.Clear();
  rw_.Clear();
  rv_.Clear();
  rm_.Clear();
  cached_has_bits = _has_bits_[0];
  if (cached_has_bits & 3u) {
    if (cached_has_bits & 0x00000001u) {
      w_.ClearNonDefaultToEmptyNoArena();
    }
    if (cached_has_bits & 0x00000002u) {
      GOOGLE_DCHECK(m_ != NULL);
      m_->Clear();
    }
  }
  v_ = 0;
  _has_bits_.Clear();
  _internal_metadata_.Clear();
}

bool TestDiffMessage::MergePartialFromCodedStream(
    ::google::protobuf::io::CodedInputStream* input) {
#define DO_(EXPRESSION) if (!GOOGLE_PREDICT_TRUE(EXPRESSION)) goto failure
  ::google::protobuf::uint32 tag;
  // @@protoc_insertion_point(parse_start:protobuf_unittest.TestDiffMessage)
  for (;;) {
    ::std::pair<::google::protobuf::uint32, bool> p = input->ReadTagWithCutoffNoLastTag(127u);
    tag = p.first;
    if (!p.second) goto handle_unusual;
    switch (::google::protobuf::internal::WireFormatLite::GetTagFieldNumber(tag)) {
      // repeated group Item = 1 { ... };
      case 1: {
        if (static_cast< ::google::protobuf::uint8>(tag) ==
            static_cast< ::google::protobuf::uint8>(11u /* 11 & 0xFF */)) {
          DO_(::google::protobuf::internal::WireFormatLite::ReadGroup(1, input, add_item()));
        } else {
          goto handle_unusual;
        }
        break;
      }

      // repeated string rw = 10;
      case 10: {
        if (static_cast< ::google::protobuf::uint8>(tag) ==
            static_cast< ::google::protobuf::uint8>(82u /* 82 & 0xFF */)) {
          DO_(::google::protobuf::internal::WireFormatLite::ReadString(
                input, this->add_rw()));
          ::google::protobuf::internal::WireFormat::VerifyUTF8StringNamedField(
            this->rw(this->rw_size() - 1).data(),
            static_cast<int>(this->rw(this->rw_size() - 1).length()),
            ::google::protobuf::internal::WireFormat::PARSE,
            "protobuf_unittest.TestDiffMessage.rw");
        } else {
          goto handle_unusual;
        }
        break;
      }

      // repeated int32 rv = 11;
      case 11: {
        if (static_cast< ::google::protobuf::uint8>(tag) ==
            static_cast< ::google::protobuf::uint8>(88u /* 88 & 0xFF */)) {
          DO_((::google::protobuf::internal::WireFormatLite::ReadRepeatedPrimitive<
                   ::google::protobuf::int32, ::google::protobuf::internal::WireFormatLite::TYPE_INT32>(
                 1, 88u, input, this->mutable_rv())));
        } else if (
            static_cast< ::google::protobuf::uint8>(tag) ==
            static_cast< ::google::protobuf::uint8>(90u /* 90 & 0xFF */)) {
          DO_((::google::protobuf::internal::WireFormatLite::ReadPackedPrimitiveNoInline<
                   ::google::protobuf::int32, ::google::protobuf::internal::WireFormatLite::TYPE_INT32>(
                 input, this->mutable_rv())));
        } else {
          goto handle_unusual;
        }
        break;
      }

      // repeated .protobuf_unittest.TestField rm = 12 [deprecated = true];
      case 12: {
        if (static_cast< ::google::protobuf::uint8>(tag) ==
            static_cast< ::google::protobuf::uint8>(98u /* 98 & 0xFF */)) {
          DO_(::google::protobuf::internal::WireFormatLite::ReadMessage(
                input, add_rm()));
        } else {
          goto handle_unusual;
        }
        break;
      }

      // optional int32 v = 13 [deprecated = true];
      case 13: {
        if (static_cast< ::google::protobuf::uint8>(tag) ==
            static_cast< ::google::protobuf::uint8>(104u /* 104 & 0xFF */)) {
          set_has_v();
          DO_((::google::protobuf::internal::WireFormatLite::ReadPrimitive<
                   ::google::protobuf::int32, ::google::protobuf::internal::WireFormatLite::TYPE_INT32>(
                 input, &v_)));
        } else {
          goto handle_unusual;
        }
        break;
      }

      // optional string w = 14;
      case 14: {
        if (static_cast< ::google::protobuf::uint8>(tag) ==
            static_cast< ::google::protobuf::uint8>(114u /* 114 & 0xFF */)) {
          DO_(::google::protobuf::internal::WireFormatLite::ReadString(
                input, this->mutable_w()));
          ::google::protobuf::internal::WireFormat::VerifyUTF8StringNamedField(
            this->w().data(), static_cast<int>(this->w().length()),
            ::google::protobuf::internal::WireFormat::PARSE,
            "protobuf_unittest.TestDiffMessage.w");
        } else {
          goto handle_unusual;
        }
        break;
      }

      // optional .protobuf_unittest.TestField m = 15;
      case 15: {
        if (static_cast< ::google::protobuf::uint8>(tag) ==
            static_cast< ::google::protobuf::uint8>(122u /* 122 & 0xFF */)) {
          DO_(::google::protobuf::internal::WireFormatLite::ReadMessage(
               input, mutable_m()));
        } else {
          goto handle_unusual;
        }
        break;
      }

      default: {
      handle_unusual:
        if (tag == 0) {
          goto success;
        }
        if ((800u <= tag && tag < 1600u)) {
          DO_(_extensions_.ParseField(tag, input,
              internal_default_instance(),
              _internal_metadata_.mutable_unknown_fields()));
          continue;
        }
        DO_(::google::protobuf::internal::WireFormat::SkipField(
              input, tag, _internal_metadata_.mutable_unknown_fields()));
        break;
      }
    }
  }
success:
  // @@protoc_insertion_point(parse_success:protobuf_unittest.TestDiffMessage)
  return true;
failure:
  // @@protoc_insertion_point(parse_failure:protobuf_unittest.TestDiffMessage)
  return false;
#undef DO_
}

void TestDiffMessage::SerializeWithCachedSizes(
    ::google::protobuf::io::CodedOutputStream* output) const {
  // @@protoc_insertion_point(serialize_start:protobuf_unittest.TestDiffMessage)
  ::google::protobuf::uint32 cached_has_bits = 0;
  (void) cached_has_bits;

  // repeated group Item = 1 { ... };
  for (unsigned int i = 0,
      n = static_cast<unsigned int>(this->item_size()); i < n; i++) {
    ::google::protobuf::internal::WireFormatLite::WriteGroupMaybeToArray(
      1,
      this->item(static_cast<int>(i)),
      output);
  }

  // repeated string rw = 10;
  for (int i = 0, n = this->rw_size(); i < n; i++) {
    ::google::protobuf::internal::WireFormat::VerifyUTF8StringNamedField(
      this->rw(i).data(), static_cast<int>(this->rw(i).length()),
      ::google::protobuf::internal::WireFormat::SERIALIZE,
      "protobuf_unittest.TestDiffMessage.rw");
    ::google::protobuf::internal::WireFormatLite::WriteString(
      10, this->rw(i), output);
  }

  // repeated int32 rv = 11;
  for (int i = 0, n = this->rv_size(); i < n; i++) {
    ::google::protobuf::internal::WireFormatLite::WriteInt32(
      11, this->rv(i), output);
  }

  // repeated .protobuf_unittest.TestField rm = 12 [deprecated = true];
  for (unsigned int i = 0,
      n = static_cast<unsigned int>(this->rm_size()); i < n; i++) {
    ::google::protobuf::internal::WireFormatLite::WriteMessageMaybeToArray(
      12,
      this->rm(static_cast<int>(i)),
      output);
  }

  cached_has_bits = _has_bits_[0];
  // optional int32 v = 13 [deprecated = true];
  if (cached_has_bits & 0x00000004u) {
    ::google::protobuf::internal::WireFormatLite::WriteInt32(13, this->v(), output);
  }

  // optional string w = 14;
  if (cached_has_bits & 0x00000001u) {
    ::google::protobuf::internal::WireFormat::VerifyUTF8StringNamedField(
      this->w().data(), static_cast<int>(this->w().length()),
      ::google::protobuf::internal::WireFormat::SERIALIZE,
      "protobuf_unittest.TestDiffMessage.w");
    ::google::protobuf::internal::WireFormatLite::WriteStringMaybeAliased(
      14, this->w(), output);
  }

  // optional .protobuf_unittest.TestField m = 15;
  if (cached_has_bits & 0x00000002u) {
    ::google::protobuf::internal::WireFormatLite::WriteMessageMaybeToArray(
      15, this->_internal_m(), output);
  }

  // Extension range [100, 200)
  _extensions_.SerializeWithCachedSizes(
      100, 200, output);

  if (_internal_metadata_.have_unknown_fields()) {
    ::google::protobuf::internal::WireFormat::SerializeUnknownFields(
        _internal_metadata_.unknown_fields(), output);
  }
  // @@protoc_insertion_point(serialize_end:protobuf_unittest.TestDiffMessage)
}

::google::protobuf::uint8* TestDiffMessage::InternalSerializeWithCachedSizesToArray(
    bool deterministic, ::google::protobuf::uint8* target) const {
  (void)deterministic; // Unused
  // @@protoc_insertion_point(serialize_to_array_start:protobuf_unittest.TestDiffMessage)
  ::google::protobuf::uint32 cached_has_bits = 0;
  (void) cached_has_bits;

  // repeated group Item = 1 { ... };
  for (unsigned int i = 0,
      n = static_cast<unsigned int>(this->item_size()); i < n; i++) {
    target = ::google::protobuf::internal::WireFormatLite::
      InternalWriteGroupToArray(
        1, this->item(static_cast<int>(i)), deterministic, target);
  }

  // repeated string rw = 10;
  for (int i = 0, n = this->rw_size(); i < n; i++) {
    ::google::protobuf::internal::WireFormat::VerifyUTF8StringNamedField(
      this->rw(i).data(), static_cast<int>(this->rw(i).length()),
      ::google::protobuf::internal::WireFormat::SERIALIZE,
      "protobuf_unittest.TestDiffMessage.rw");
    target = ::google::protobuf::internal::WireFormatLite::
      WriteStringToArray(10, this->rw(i), target);
  }

  // repeated int32 rv = 11;
  target = ::google::protobuf::internal::WireFormatLite::
    WriteInt32ToArray(11, this->rv_, target);

  // repeated .protobuf_unittest.TestField rm = 12 [deprecated = true];
  for (unsigned int i = 0,
      n = static_cast<unsigned int>(this->rm_size()); i < n; i++) {
    target = ::google::protobuf::internal::WireFormatLite::
      InternalWriteMessageToArray(
        12, this->rm(static_cast<int>(i)), deterministic, target);
  }

  cached_has_bits = _has_bits_[0];
  // optional int32 v = 13 [deprecated = true];
  if (cached_has_bits & 0x00000004u) {
    target = ::google::protobuf::internal::WireFormatLite::WriteInt32ToArray(13, this->v(), target);
  }

  // optional string w = 14;
  if (cached_has_bits & 0x00000001u) {
    ::google::protobuf::internal::WireFormat::VerifyUTF8StringNamedField(
      this->w().data(), static_cast<int>(this->w().length()),
      ::google::protobuf::internal::WireFormat::SERIALIZE,
      "protobuf_unittest.TestDiffMessage.w");
    target =
      ::google::protobuf::internal::WireFormatLite::WriteStringToArray(
        14, this->w(), target);
  }

  // optional .protobuf_unittest.TestField m = 15;
  if (cached_has_bits & 0x00000002u) {
    target = ::google::protobuf::internal::WireFormatLite::
      InternalWriteMessageToArray(
        15, this->_internal_m(), deterministic, target);
  }

  // Extension range [100, 200)
  target = _extensions_.InternalSerializeWithCachedSizesToArray(
      100, 200, deterministic, target);

  if (_internal_metadata_.have_unknown_fields()) {
    target = ::google::protobuf::internal::WireFormat::SerializeUnknownFieldsToArray(
        _internal_metadata_.unknown_fields(), target);
  }
  // @@protoc_insertion_point(serialize_to_array_end:protobuf_unittest.TestDiffMessage)
  return target;
}

size_t TestDiffMessage::ByteSizeLong() const {
// @@protoc_insertion_point(message_byte_size_start:protobuf_unittest.TestDiffMessage)
  size_t total_size = 0;

  total_size += _extensions_.ByteSize();

  if (_internal_metadata_.have_unknown_fields()) {
    total_size +=
      ::google::protobuf::internal::WireFormat::ComputeUnknownFieldsSize(
        _internal_metadata_.unknown_fields());
  }
  // repeated group Item = 1 { ... };
  {
    unsigned int count = static_cast<unsigned int>(this->item_size());
    total_size += 2UL * count;
    for (unsigned int i = 0; i < count; i++) {
      total_size +=
        ::google::protobuf::internal::WireFormatLite::GroupSize(
          this->item(static_cast<int>(i)));
    }
  }

  // repeated string rw = 10;
  total_size += 1 *
      ::google::protobuf::internal::FromIntSize(this->rw_size());
  for (int i = 0, n = this->rw_size(); i < n; i++) {
    total_size += ::google::protobuf::internal::WireFormatLite::StringSize(
      this->rw(i));
  }

  // repeated int32 rv = 11;
  {
    size_t data_size = ::google::protobuf::internal::WireFormatLite::
      Int32Size(this->rv_);
    total_size += 1 *
                  ::google::protobuf::internal::FromIntSize(this->rv_size());
    total_size += data_size;
  }

  // repeated .protobuf_unittest.TestField rm = 12 [deprecated = true];
  {
    unsigned int count = static_cast<unsigned int>(this->rm_size());
    total_size += 1UL * count;
    for (unsigned int i = 0; i < count; i++) {
      total_size +=
        ::google::protobuf::internal::WireFormatLite::MessageSize(
          this->rm(static_cast<int>(i)));
    }
  }

  if (_has_bits_[0 / 32] & 7u) {
    // optional string w = 14;
    if (has_w()) {
      total_size += 1 +
        ::google::protobuf::internal::WireFormatLite::StringSize(
          this->w());
    }

    // optional .protobuf_unittest.TestField m = 15;
    if (has_m()) {
      total_size += 1 +
        ::google::protobuf::internal::WireFormatLite::MessageSize(
          *m_);
    }

    // optional int32 v = 13 [deprecated = true];
    if (has_v()) {
      total_size += 1 +
        ::google::protobuf::internal::WireFormatLite::Int32Size(
          this->v());
    }

  }
  int cached_size = ::google::protobuf::internal::ToCachedSize(total_size);
  SetCachedSize(cached_size);
  return total_size;
}

void TestDiffMessage::MergeFrom(const ::google::protobuf::Message& from) {
// @@protoc_insertion_point(generalized_merge_from_start:protobuf_unittest.TestDiffMessage)
  GOOGLE_DCHECK_NE(&from, this);
  const TestDiffMessage* source =
      ::google::protobuf::internal::DynamicCastToGenerated<const TestDiffMessage>(
          &from);
  if (source == NULL) {
  // @@protoc_insertion_point(generalized_merge_from_cast_fail:protobuf_unittest.TestDiffMessage)
    ::google::protobuf::internal::ReflectionOps::Merge(from, this);
  } else {
  // @@protoc_insertion_point(generalized_merge_from_cast_success:protobuf_unittest.TestDiffMessage)
    MergeFrom(*source);
  }
}

void TestDiffMessage::MergeFrom(const TestDiffMessage& from) {
// @@protoc_insertion_point(class_specific_merge_from_start:protobuf_unittest.TestDiffMessage)
  GOOGLE_DCHECK_NE(&from, this);
  _extensions_.MergeFrom(from._extensions_);
  _internal_metadata_.MergeFrom(from._internal_metadata_);
  ::google::protobuf::uint32 cached_has_bits = 0;
  (void) cached_has_bits;

  item_.MergeFrom(from.item_);
  rw_.MergeFrom(from.rw_);
  rv_.MergeFrom(from.rv_);
  rm_.MergeFrom(from.rm_);
  cached_has_bits = from._has_bits_[0];
  if (cached_has_bits & 7u) {
    if (cached_has_bits & 0x00000001u) {
      set_has_w();
      w_.AssignWithDefault(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), from.w_);
    }
    if (cached_has_bits & 0x00000002u) {
      mutable_m()->::protobuf_unittest::TestField::MergeFrom(from.m());
    }
    if (cached_has_bits & 0x00000004u) {
      v_ = from.v_;
    }
    _has_bits_[0] |= cached_has_bits;
  }
}

void TestDiffMessage::CopyFrom(const ::google::protobuf::Message& from) {
// @@protoc_insertion_point(generalized_copy_from_start:protobuf_unittest.TestDiffMessage)
  if (&from == this) return;
  Clear();
  MergeFrom(from);
}

void TestDiffMessage::CopyFrom(const TestDiffMessage& from) {
// @@protoc_insertion_point(class_specific_copy_from_start:protobuf_unittest.TestDiffMessage)
  if (&from == this) return;
  Clear();
  MergeFrom(from);
}

bool TestDiffMessage::IsInitialized() const {
  if (!_extensions_.IsInitialized()) {
    return false;
  }

  return true;
}

void TestDiffMessage::Swap(TestDiffMessage* other) {
  if (other == this) return;
  InternalSwap(other);
}
void TestDiffMessage::InternalSwap(TestDiffMessage* other) {
  using std::swap;
  CastToBase(&item_)->InternalSwap(CastToBase(&other->item_));
  rw_.InternalSwap(CastToBase(&other->rw_));
  rv_.InternalSwap(&other->rv_);
  CastToBase(&rm_)->InternalSwap(CastToBase(&other->rm_));
  w_.Swap(&other->w_, &::google::protobuf::internal::GetEmptyStringAlreadyInited(),
    GetArenaNoVirtual());
  swap(m_, other->m_);
  swap(v_, other->v_);
  swap(_has_bits_[0], other->_has_bits_[0]);
  _internal_metadata_.Swap(&other->_internal_metadata_);
  _extensions_.Swap(&other->_extensions_);
}

::google::protobuf::Metadata TestDiffMessage::GetMetadata() const {
  protobuf_google_2fprotobuf_2futil_2fmessage_5fdifferencer_5funittest_2eproto::protobuf_AssignDescriptorsOnce();
  return ::protobuf_google_2fprotobuf_2futil_2fmessage_5fdifferencer_5funittest_2eproto::file_level_metadata[kIndexInFileMessages];
}

#if !defined(_MSC_VER) || _MSC_VER >= 1900
const int TestField::kTfFieldNumber;
#endif
::google::protobuf::internal::ExtensionIdentifier< ::protobuf_unittest::TestDiffMessage,
    ::google::protobuf::internal::MessageTypeTraits< ::protobuf_unittest::TestField >, 11, false >
  TestField::tf(kTfFieldNumber, *::protobuf_unittest::TestField::internal_default_instance());

// @@protoc_insertion_point(namespace_scope)
}  // namespace protobuf_unittest
namespace google {
namespace protobuf {
template<> GOOGLE_PROTOBUF_ATTRIBUTE_NOINLINE ::protobuf_unittest::TestField* Arena::CreateMaybeMessage< ::protobuf_unittest::TestField >(Arena* arena) {
  return Arena::CreateInternal< ::protobuf_unittest::TestField >(arena);
}
template<> GOOGLE_PROTOBUF_ATTRIBUTE_NOINLINE ::protobuf_unittest::TestDiffMessage_Item* Arena::CreateMaybeMessage< ::protobuf_unittest::TestDiffMessage_Item >(Arena* arena) {
  return Arena::CreateInternal< ::protobuf_unittest::TestDiffMessage_Item >(arena);
}
template<> GOOGLE_PROTOBUF_ATTRIBUTE_NOINLINE ::protobuf_unittest::TestDiffMessage* Arena::CreateMaybeMessage< ::protobuf_unittest::TestDiffMessage >(Arena* arena) {
  return Arena::CreateInternal< ::protobuf_unittest::TestDiffMessage >(arena);
}
}  // namespace protobuf
}  // namespace google

// @@protoc_insertion_point(global_scope)
