Skip to content

Commit

Permalink
Remove use of floor function which causes linkage problems on Windows.
Browse files Browse the repository at this point in the history
  • Loading branch information
mikeb01 committed Sep 11, 2020
1 parent 8306bc8 commit b9c1b3e
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion src/hdr_histogram.c
Original file line number Diff line number Diff line change
Expand Up @@ -341,8 +341,13 @@ int hdr_calculate_bucket_config(
sub_bucket_count_magnitude = (int32_t) ceil(log((double)largest_value_with_single_unit_resolution) / log(2));
cfg->sub_bucket_half_count_magnitude = ((sub_bucket_count_magnitude > 1) ? sub_bucket_count_magnitude : 1) - 1;

cfg->unit_magnitude = (int32_t) floor(log((double)lowest_trackable_value) / log(2));
double unit_magnitude = log((double)lowest_trackable_value) / log(2);
if (INT32_MAX < unit_magnitude)
{
return EINVAL;
}

cfg->unit_magnitude = (int32_t) unit_magnitude;
cfg->sub_bucket_count = (int32_t) pow(2, (cfg->sub_bucket_half_count_magnitude + 1));
cfg->sub_bucket_half_count = cfg->sub_bucket_count / 2;
cfg->sub_bucket_mask = ((int64_t) cfg->sub_bucket_count - 1) << cfg->unit_magnitude;
Expand Down

0 comments on commit b9c1b3e

Please sign in to comment.