We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 9a9220b commit d979d5bCopy full SHA for d979d5b
drivers/cpp/benchmarks/histogram/21_histogram_bin_0-100/baseline.hpp
@@ -11,7 +11,8 @@
11
*/
12
void NO_INLINE correctBinsBy10Count(std::vector<double> const& x, std::array<size_t, 10> &bins) {
13
for (size_t i = 0; i < x.size(); i += 1) {
14
- const size_t bin = x[i] / 10;
+ size_t bin = static_cast<size_t>(x[i] / 10);
15
+ bin = std::min(bin, bins.size() - 1);
16
bins[bin] += 1;
17
}
18
0 commit comments