@@ -265,8 +265,10 @@ std::unique_ptr<Aggregation> Base2ExponentialHistogramAggregation::Merge(
265
265
auto neg_max_index =
266
266
(std::max)(low_res.negative_buckets_ .EndIndex (), high_res.negative_buckets_ .EndIndex ());
267
267
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_ )
270
272
{
271
273
// We need to downscale the buckets to fit into the new max_buckets_.
272
274
const uint32_t scale_reduction =
@@ -316,8 +318,10 @@ std::unique_ptr<Aggregation> Base2ExponentialHistogramAggregation::Diff(
316
318
auto neg_max_index =
317
319
(std::max)(left.negative_buckets_ .EndIndex (), right.negative_buckets_ .EndIndex ());
318
320
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_ )
321
325
{
322
326
// We need to downscale the buckets to fit into the new max_buckets_.
323
327
const uint32_t scale_reduction =
@@ -351,7 +355,7 @@ std::unique_ptr<Aggregation> Base2ExponentialHistogramAggregation::Diff(
351
355
auto l_cnt = left.positive_buckets_ .Get (i);
352
356
auto r_cnt = right.positive_buckets_ .Get (i);
353
357
// 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);
355
359
if (l_cnt > 0 )
356
360
{
357
361
result_value.positive_buckets_ .Increment (i, delta);
@@ -366,7 +370,7 @@ std::unique_ptr<Aggregation> Base2ExponentialHistogramAggregation::Diff(
366
370
auto l_cnt = left.negative_buckets_ .Get (i);
367
371
auto r_cnt = right.negative_buckets_ .Get (i);
368
372
// 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);
370
374
if (delta > 0 )
371
375
{
372
376
result_value.negative_buckets_ .Increment (i, delta);
0 commit comments