@@ -265,8 +265,10 @@ std::unique_ptr<Aggregation> Base2ExponentialHistogramAggregation::Merge(
265265 auto neg_max_index =
266266 (std::max)(low_res.negative_buckets_ .EndIndex (), high_res.negative_buckets_ .EndIndex ());
267267
268- if (pos_max_index > pos_min_index + result_value.max_buckets_ ||
269- neg_max_index > neg_min_index + result_value.max_buckets_ )
268+ if (static_cast <size_t >(pos_max_index) >
269+ static_cast <size_t >(pos_min_index) + result_value.max_buckets_ ||
270+ static_cast <size_t >(neg_max_index) >
271+ static_cast <size_t >(neg_min_index) + result_value.max_buckets_ )
270272 {
271273 // We need to downscale the buckets to fit into the new max_buckets_.
272274 const uint32_t scale_reduction =
@@ -316,8 +318,10 @@ std::unique_ptr<Aggregation> Base2ExponentialHistogramAggregation::Diff(
316318 auto neg_max_index =
317319 (std::max)(left.negative_buckets_ .EndIndex (), right.negative_buckets_ .EndIndex ());
318320
319- if (pos_max_index > pos_min_index + low_res.max_buckets_ ||
320- neg_max_index > neg_min_index + low_res.max_buckets_ )
321+ if (static_cast <size_t >(pos_max_index) >
322+ static_cast <size_t >(pos_min_index) + low_res.max_buckets_ ||
323+ static_cast <size_t >(neg_max_index) >
324+ static_cast <size_t >(neg_min_index) + low_res.max_buckets_ )
321325 {
322326 // We need to downscale the buckets to fit into the new max_buckets_.
323327 const uint32_t scale_reduction =
@@ -351,7 +355,7 @@ std::unique_ptr<Aggregation> Base2ExponentialHistogramAggregation::Diff(
351355 auto l_cnt = left.positive_buckets_ .Get (i);
352356 auto r_cnt = right.positive_buckets_ .Get (i);
353357 // expect right >= left since metric points should be monotonically increasing
354- auto delta = (std::max)(( uint64_t ) (0 ), r_cnt - l_cnt);
358+ auto delta = (std::max)(static_cast < uint64_t > (0 ), r_cnt - l_cnt);
355359 if (l_cnt > 0 )
356360 {
357361 result_value.positive_buckets_ .Increment (i, delta);
@@ -366,7 +370,7 @@ std::unique_ptr<Aggregation> Base2ExponentialHistogramAggregation::Diff(
366370 auto l_cnt = left.negative_buckets_ .Get (i);
367371 auto r_cnt = right.negative_buckets_ .Get (i);
368372 // expect right >= left since metric points should be monotonically increasing
369- auto delta = (std::max)(( uint64_t ) (0 ), r_cnt - l_cnt);
373+ auto delta = (std::max)(static_cast < uint64_t > (0 ), r_cnt - l_cnt);
370374 if (delta > 0 )
371375 {
372376 result_value.negative_buckets_ .Increment (i, delta);
0 commit comments