Fix static analysis warnings.

This commit is contained in:
guangli-dai
2023-12-13 15:21:09 -08:00
committed by Qi Wang
parent e4817c8d89
commit eda05b3994
9 changed files with 33 additions and 15 deletions

View File

@@ -277,7 +277,8 @@ prof_sample_new_event_wait(tsd_t *tsd) {
* otherwise bytes_until_sample would be 0 if u is exactly 1.0.
*/
uint64_t r = prng_lg_range_u64(tsd_prng_statep_get(tsd), 53);
double u = (r == 0U) ? 1.0 : (double)r * (1.0/9007199254740992.0L);
double u = (r == 0U) ? 1.0 : (double)((long double)r *
(1.0L/9007199254740992.0L));
return (uint64_t)(log(u) /
log(1.0 - (1.0 / (double)((uint64_t)1U << lg_prof_sample))))
+ (uint64_t)1U;