Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit f1ff65c9 authored by Myles Watson's avatar Myles Watson Committed by Automerger Merge Worker
Browse files

Merge "PDL: Exit early when parsing counted vectors" into main am: 8cf69e75

parents 586b5a27 8cf69e75
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -119,6 +119,7 @@ void VectorField::GenExtractor(std::ostream& s, int num_leading_bits, bool for_s
  }
  s << "while (";
  if (size_field_ != nullptr && size_field_->GetFieldType() == CountField::kFieldType) {
    s << "(" << element_field_->GetName() << "_count > 0) && ";
    s << "(" << element_field_->GetName() << "_count-- > 0) && ";
  }
  if (!element_size_.empty()) {
+20 −0
Original line number Diff line number Diff line
@@ -135,11 +135,24 @@ packet SizedArrayEnum {
  enum_array : ForArrays[],
}

test SizedArrayEnum {
  "\x00\x00",
  "\x02\x00\x01\x02",
  "\x04\x00\x01\x02\x11\x12",
  "\x06\x00\x01\x02\x11\x12\x21\x22",
}

packet CountArrayEnum {
  _count_(enum_array) : 8,
  enum_array : ForArrays[],
}

test CountArrayEnum {
  "\x01\x01\x02",
  "\x02\x01\x02\x11\x12",
  "\x03\x01\x02\x11\x12\x21\x22",
}

packet SizedArrayCustom {
  _size_(six_bytes_array) : 8,
  an_extra_byte : 8,
@@ -197,6 +210,13 @@ packet VectorOfStruct {
  array : TwoRelatedNumbers[],
}

test VectorOfStruct {
  "\x00",
  "\x01\x01\x02\x03",
  "\x02\x01\x02\x03\x11\x12\x13",
  "\x03\x01\x02\x03\x11\x12\x13\x21\x22\x23",
}

packet ArrayOfStruct {
  the_count : 8,
  array : TwoRelatedNumbers[4],