GAPI - KW fixes

- avoid overflow in own::Mat::total() and according tests
This commit is contained in:
Anton Potapov
2020-03-12 13:29:54 +03:00
parent 866b15ddb8
commit d3b68b059b
2 changed files with 14 additions and 9 deletions
@@ -297,10 +297,9 @@ namespace cv { namespace gapi { namespace own {
*/
size_t total() const
{
return static_cast<std::size_t>
(dims.empty()
? (rows * cols)
: std::accumulate(dims.begin(), dims.end(), 1, std::multiplies<int>()));
return dims.empty()
? (static_cast<std::size_t>(rows) * cols)
: std::accumulate(dims.begin(), dims.end(), static_cast<std::size_t>(1), std::multiplies<size_t>());
}
/** @overload