Skip to content

Commit

Permalink
fixed bad math for --annotate-sparse-vectors
Browse files Browse the repository at this point in the history
  • Loading branch information
dbaileychess committed Feb 7, 2023
1 parent 6af83a7 commit 4c71f87
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/annotated_binary_text_gen.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -367,18 +367,18 @@ static void GenerateSection(std::ostream &os, const BinarySection &section,

// As a space saving measure, skip generating every vector element, just put
// the first and last elements in the output. Skip the whole thing if there
// are only two or fewer elements, as it doesn't save space.
// are only three or fewer elements, as it doesn't save space.
if (section.type == BinarySectionType::Vector &&
!output_config.include_vector_contents && section.regions.size() > 3) {
!output_config.include_vector_contents && section.regions.size() > 4) {
// Generate the length region which should be first.
GenerateRegion(os, section.regions[0], section, binary, output_config);

// Generate the first element.
GenerateRegion(os, section.regions[1], section, binary, output_config);

// Indicate that we omitted lines.
// Indicate that we omitted elements.
os << std::endl
<< " <" << section.regions.size() - 2 << " regions omitted>";
<< " <" << section.regions.size() - 3 << " regions omitted>";

// Generate the last element.
GenerateRegion(os, section.regions.back(), section, binary, output_config);
Expand Down

0 comments on commit 4c71f87

Please sign in to comment.