bool CompactProtocolReader::advanceToNextField(
    int32_t currFieldId,
    int32_t nextFieldId,
    TType nextFieldType,
    StructReadState& state) {
  if (in_.length()) {
    if (nextFieldType == TType::T_STOP) {
      if (*in_.data() == TType::T_STOP) {
        in_.skipNoAdvance(1);
        return true;
      }
    } else if (nextFieldId > currFieldId && (nextFieldId - currFieldId <= 15)) {
      if (matchTypeHeader(
              *in_.data(), nextFieldType, nextFieldId - currFieldId)) {
        in_.skipNoAdvance(1);
        return true;
      }
    } else if (matchTypeHeader(*in_.data(), nextFieldType, 0)) {
      // In one byte, we can fit values up to 127 (7-bit, due to varint),
      // which corresponds to a range [-64; 63] with zigzag encoding.
      // In two bytes, we can fit values up to 16383 (14-bit), which corresponds
      // to a range [-8192; 8191] with zigzag encoding.
      if (nextFieldId >= -64 && nextFieldId <= 63) {
        if (in_.length() > 1 &&
            *(in_.data() + 1) ==
                static_cast<uint8_t>(util::i32ToZigzag(nextFieldId))) {
          in_.skipNoAdvance(2);
          return true;
        }
      } else if (nextFieldId >= -8192 && nextFieldId <= 8191) {
        if (in_.length() > 2 &&
            *(in_.data() + 1) ==
                ((util::i32ToZigzag(nextFieldId) & 0x7F) | 0x80) &&
            *(in_.data() + 2) ==
                ((util::i32ToZigzag(nextFieldId) & 0x3F80) >> 7)) {
          in_.skipNoAdvance(3);
          return true;
        }
      } else {
        if (in_.length() > 3 &&
            *(in_.data() + 1) ==
                ((util::i32ToZigzag(nextFieldId) & 0x7F) | 0x80) &&
            *(in_.data() + 2) ==
                ((util::i32ToZigzag(nextFieldId) & 0x3F80) >> 7 | 0x80) &&
            *(in_.data() + 3) ==
                ((util::i32ToZigzag(nextFieldId) & 0x1FC000) >> 14)) {
          in_.skipNoAdvance(4);
          return true;
        }
      }
    }

    readFieldBeginWithStateMediumSlow(state, currFieldId);
  } else {
    // We're out of luck, fallback to slow path.
    state.fieldId = currFieldId;
    state.readFieldBeginNoInline(this);
  }
  return false;
}
bool CompactProtocolReader::advanceToNextField(
    int32_t currFieldId,
    int32_t nextFieldId,
    TType nextFieldType,
    StructReadState& state) {
  if (in_.length()) {
    if (nextFieldType == TType::T_STOP) {
      if (*in_.data() == TType::T_STOP) {
        in_.skipNoAdvance(1);
        return true;
      }
    } else if (nextFieldId > currFieldId && (nextFieldId - currFieldId <= 15)) {
      if (matchTypeHeader(
              *in_.data(), nextFieldType, nextFieldId - currFieldId)) {
        in_.skipNoAdvance(1);
        return true;
      }
    } else if (matchTypeHeader(*in_.data(), nextFieldType, 0)) {
       
       
       
       
      if (nextFieldId >= -64 && nextFieldId <= 63) {
        if (in_.length() > 1 &&
            *(in_.data() + 1) ==
                static_cast<uint8_t>(util::i32ToZigzag(nextFieldId))) {
          in_.skipNoAdvance(2);
          return true;
        }
      } else if (nextFieldId >= -8192 && nextFieldId <= 8191) {
        if (in_.length() > 2 &&
            *(in_.data() + 1) ==
                ((util::i32ToZigzag(nextFieldId) & 0x7F) | 0x80) &&
            *(in_.data() + 2) ==
                ((util::i32ToZigzag(nextFieldId) & 0x3F80) >> 7)) {
          in_.skipNoAdvance(3);
          return true;
        }
      } else {
        if (in_.length() > 3 &&
            *(in_.data() + 1) ==
                ((util::i32ToZigzag(nextFieldId) & 0x7F) | 0x80) &&
            *(in_.data() + 2) ==
                ((util::i32ToZigzag(nextFieldId) & 0x3F80) >> 7 | 0x80) &&
            *(in_.data() + 3) ==
                ((util::i32ToZigzag(nextFieldId) & 0x1FC000) >> 14)) {
          in_.skipNoAdvance(4);
          return true;
        }
      }
    }

    readFieldBeginWithStateMediumSlow(state, currFieldId);
  } else {
     
    state.fieldId = currFieldId;
    state.readFieldBeginNoInline(this);
  }
  return false;
}