Message ID | 20250929201924.45019-6-mzamazal@redhat.com |
---|---|
State | New |
Headers | show |
Series |
|
Related | show |
Hi, On 29-Sep-25 10:19 PM, Milan Zamazal wrote: > 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 <mzamazal@redhat.com> Thanks, patch looks good to me: Reviewed-by: Hans de Goede <hansg@kernel.org> Regards, Hans > --- > 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 b1eb7d310..fb21396ef 100644 > --- a/src/ipa/simple/algorithms/awb.cpp > +++ b/src/ipa/simple/algorithms/awb.cpp > @@ -68,7 +68,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;
2025. 09. 29. 22:19 keltezéssel, Milan Zamazal írta: > 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 <mzamazal@redhat.com> > --- Reviewed-by: Barnabás Pőcze <barnabas.pocze@ideasonboard.com> > 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 b1eb7d310..fb21396ef 100644 > --- a/src/ipa/simple/algorithms/awb.cpp > +++ b/src/ipa/simple/algorithms/awb.cpp > @@ -68,7 +68,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; > -- > 2.51.0 >
diff --git a/src/ipa/simple/algorithms/awb.cpp b/src/ipa/simple/algorithms/awb.cpp index b1eb7d310..fb21396ef 100644 --- a/src/ipa/simple/algorithms/awb.cpp +++ b/src/ipa/simple/algorithms/awb.cpp @@ -68,7 +68,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;
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 <mzamazal@redhat.com> --- src/ipa/simple/algorithms/awb.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)