Skip to content

Commit

Permalink
Fix histogram indexing when accessed via operator [] (#939)
Browse files Browse the repository at this point in the history
  • Loading branch information
bgromov authored Jul 31, 2024
1 parent 211b8c2 commit f01edbc
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
4 changes: 2 additions & 2 deletions include/etl/histogram.h
Original file line number Diff line number Diff line change
Expand Up @@ -249,7 +249,7 @@ namespace etl
//*********************************
value_type operator [](key_type key) const
{
return this->accumulator[key];
return this->accumulator[key - Start_Index];
}
};

Expand Down Expand Up @@ -373,7 +373,7 @@ namespace etl
//*********************************
value_type operator [](key_type key) const
{
return this->accumulator[key];
return this->accumulator[key - start_index];
}

private:
Expand Down
2 changes: 1 addition & 1 deletion test/test_histogram.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -247,7 +247,7 @@ namespace

for (size_t i = 0UL; i < output1.size(); ++i)
{
CHECK_EQUAL(int(output1[i]), int(histogram[i]));
CHECK_EQUAL(int(output1[i]), int(histogram[i - 4]));
}
}

Expand Down

0 comments on commit f01edbc

Please sign in to comment.