diff --git a/include/etl/histogram.h b/include/etl/histogram.h index 15d54222a..ada532322 100644 --- a/include/etl/histogram.h +++ b/include/etl/histogram.h @@ -249,7 +249,7 @@ namespace etl //********************************* value_type operator [](key_type key) const { - return this->accumulator[key]; + return this->accumulator[key - Start_Index]; } }; @@ -373,7 +373,7 @@ namespace etl //********************************* value_type operator [](key_type key) const { - return this->accumulator[key]; + return this->accumulator[key - start_index]; } private: diff --git a/test/test_histogram.cpp b/test/test_histogram.cpp index 16c6373da..c682c723e 100644 --- a/test/test_histogram.cpp +++ b/test/test_histogram.cpp @@ -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])); } }