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

Commit 6d039306 authored by Henri Chataing's avatar Henri Chataing Committed by Gerrit Code Review
Browse files

Merge "bluetooth_packetgen: Minor fixes in generated code"

parents ac8e110a 93d6ebc4
Loading
Loading
Loading
Loading
+3 −3
Original line number Diff line number Diff line
@@ -74,13 +74,13 @@ class EndianInserter {

    for (size_t i = 0; i < num_bits / 8; i++) {
      if (little_endian == true) {
        it.insert_byte(static_cast<uint8_t>(value >> (i * 8)));
        it.insert_byte(static_cast<uint8_t>(static_cast<uint64_t>(value) >> (i * 8)));
      } else {
        it.insert_byte(static_cast<uint8_t>(value >> (((num_bits / 8) - i - 1) * 8)));
        it.insert_byte(static_cast<uint8_t>(static_cast<uint64_t>(value) >> (((num_bits / 8) - i - 1) * 8)));
      }
    }
    if (num_bits % 8) {
      it.insert_bits(static_cast<uint8_t>(value >> ((num_bits / 8) * 8)), num_bits % 8);
      it.insert_bits(static_cast<uint8_t>(static_cast<uint64_t>(value) >> ((num_bits / 8) * 8)), num_bits % 8);
    }
  }

+1 −1
Original line number Diff line number Diff line
@@ -35,7 +35,7 @@ void FixedScalarField::GenValue(std::ostream& s) const {
}

void FixedScalarField::GenStringRepresentation(std::ostream& s, std::string) const {
  s << "+" << value_;
  s << value_;
}

void FixedScalarField::GenRustWriter(std::ostream& s, Size start_offset, Size end_offset) const {
+4 −1
Original line number Diff line number Diff line
@@ -133,7 +133,10 @@ void ScalarField::GenValidator(std::ostream&) const {
}

void ScalarField::GenStringRepresentation(std::ostream& s, std::string accessor) const {
  s << "+" << accessor;
  // Generate a static_cast to uint64_t (largest supported field type) in order
  // to force hexadecimal formatting; uint8_t fields will be rendered as escaped
  // characters otherwise.
  s << "static_cast<uint64_t>(" << accessor << ")";
}

std::string ScalarField::GetRustDataType() const {