tools/analyse: explicit size unique_bytes accumulator

This avoids unsigned overflow.
This commit is contained in:
Danny Robson 2021-01-23 06:49:49 +10:00
parent bdc4a09356
commit e65958b9aa

View File

@ -236,7 +236,7 @@ int main (int argc, char const **argv)
auto const unique_bytes = std::accumulate ( auto const unique_bytes = std::accumulate (
src.begin (), src.begin (),
src.end (), src.end (),
0, [] (auto const &accum, auto const &rhs) { return accum + rhs.size (); } std::uintmax_t {0}, [] (auto const &accum, auto const &rhs) { return accum + rhs.size (); }
); );
auto const duplicated_bytes = total_bytes - unique_bytes; auto const duplicated_bytes = total_bytes - unique_bytes;