@@ -341,10 +341,10 @@ static int32_t buckets_needed_to_cover_value(int64_t value, int32_t sub_bucket_c
341
341
/* ## ## ######## ## ## ####### ## ## ## */
342
342
343
343
int hdr_calculate_bucket_config (
344
- int64_t lowest_discernible_value ,
345
- int64_t highest_trackable_value ,
346
- int significant_figures ,
347
- struct hdr_histogram_bucket_config * cfg )
344
+ int64_t lowest_discernible_value ,
345
+ int64_t highest_trackable_value ,
346
+ int significant_figures ,
347
+ struct hdr_histogram_bucket_config * cfg )
348
348
{
349
349
int32_t sub_bucket_count_magnitude ;
350
350
int64_t largest_value_with_single_unit_resolution ;
@@ -406,10 +406,10 @@ void hdr_init_preallocated(struct hdr_histogram* h, struct hdr_histogram_bucket_
406
406
}
407
407
408
408
int hdr_init (
409
- int64_t lowest_discernible_value ,
410
- int64_t highest_trackable_value ,
411
- int significant_figures ,
412
- struct hdr_histogram * * result )
409
+ int64_t lowest_discernible_value ,
410
+ int64_t highest_trackable_value ,
411
+ int significant_figures ,
412
+ struct hdr_histogram * * result )
413
413
{
414
414
int64_t * counts ;
415
415
struct hdr_histogram_bucket_config cfg ;
@@ -492,13 +492,12 @@ bool hdr_record_values(struct hdr_histogram* h, int64_t value, int64_t count)
492
492
{
493
493
int32_t counts_index ;
494
494
495
- if (value < 0 )
495
+ if (value < 0 || h -> highest_trackable_value < value )
496
496
{
497
497
return false;
498
498
}
499
499
500
500
counts_index = counts_index_for (h , value );
501
-
502
501
if (counts_index < 0 || h -> counts_len <= counts_index )
503
502
{
504
503
return false;
@@ -514,7 +513,7 @@ bool hdr_record_values_atomic(struct hdr_histogram* h, int64_t value, int64_t co
514
513
{
515
514
int32_t counts_index ;
516
515
517
- if (value < 0 )
516
+ if (value < 0 || h -> highest_trackable_value < value )
518
517
{
519
518
return false;
520
519
}
0 commit comments