From 0201e11f276df21513946aaa80c1a10d593f3922 Mon Sep 17 00:00:00 2001 From: Milan Zamazal Date: Mon, 29 Sep 2025 22:19:22 +0200 Subject: [PATCH] ipa: simple: awb: Use correct type in std::accumulate MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The result type of the std::accumulate() call is uint64_t; let's use the same type for the initial value (rather than the default int) to prevent summing up the values in a different integer type. Signed-off-by: Milan Zamazal Reviewed-by: Hans de Goede Reviewed-by: Barnabás Pőcze Tested-by: Hans de Goede Signed-off-by: Kieran Bingham --- src/ipa/simple/algorithms/awb.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/ipa/simple/algorithms/awb.cpp b/src/ipa/simple/algorithms/awb.cpp index 4d33b92d..cf78e980 100644 --- a/src/ipa/simple/algorithms/awb.cpp +++ b/src/ipa/simple/algorithms/awb.cpp @@ -71,7 +71,7 @@ void Awb::process(IPAContext &context, * rather than from the sensor range. */ const uint64_t nPixels = std::accumulate( - histogram.begin(), histogram.end(), 0); + histogram.begin(), histogram.end(), uint64_t(0)); const uint64_t offset = blackLevel * nPixels; const uint64_t minValid = 1; const uint64_t sumR = stats->sumR_ > offset / 4 ? stats->sumR_ - offset / 4 : minValid;