Skip to content

Commit

Permalink
Removes gratuitous (double)x.yF casts (HDFGroup#632)
Browse files Browse the repository at this point in the history
* Committing clang-format changes

* Removes gratuitous (double)x.yF casts

* Committing clang-format changes

Co-authored-by: github-actions <41898282+github-actions[bot]@users.noreply.github.com>
  • Loading branch information
derobins and github-actions[bot] committed May 24, 2021
1 parent 48aff28 commit 4c3c1e9
Show file tree
Hide file tree
Showing 41 changed files with 287 additions and 291 deletions.
46 changes: 23 additions & 23 deletions src/H5C.c
Original file line number Diff line number Diff line change
Expand Up @@ -3037,7 +3037,7 @@ H5C_set_cache_auto_resize_config(H5C_t *cache_ptr, H5C_auto_size_ctl_t *config_p
break;

case H5C_incr__threshold:
if ((config_ptr->lower_hr_threshold <= (double)0.0f) || (config_ptr->increment <= (double)1.0f) ||
if ((config_ptr->lower_hr_threshold <= 0.0) || (config_ptr->increment <= 1.0) ||
((config_ptr->apply_max_increment) && (config_ptr->max_increment <= 0)))
cache_ptr->size_increase_possible = FALSE;
break;
Expand All @@ -3057,21 +3057,21 @@ H5C_set_cache_auto_resize_config(H5C_t *cache_ptr, H5C_auto_size_ctl_t *config_p
break;

case H5C_decr__threshold:
if ((config_ptr->upper_hr_threshold >= (double)1.0f) || (config_ptr->decrement >= (double)1.0f) ||
if ((config_ptr->upper_hr_threshold >= 1.0) || (config_ptr->decrement >= 1.0) ||
((config_ptr->apply_max_decrement) && (config_ptr->max_decrement <= 0)))
cache_ptr->size_decrease_possible = FALSE;
break;

case H5C_decr__age_out:
if (((config_ptr->apply_empty_reserve) && (config_ptr->empty_reserve >= (double)1.0f)) ||
if (((config_ptr->apply_empty_reserve) && (config_ptr->empty_reserve >= 1.0)) ||
((config_ptr->apply_max_decrement) && (config_ptr->max_decrement <= 0)))
cache_ptr->size_decrease_possible = FALSE;
break;

case H5C_decr__age_out_with_threshold:
if (((config_ptr->apply_empty_reserve) && (config_ptr->empty_reserve >= (double)1.0f)) ||
if (((config_ptr->apply_empty_reserve) && (config_ptr->empty_reserve >= 1.0)) ||
((config_ptr->apply_max_decrement) && (config_ptr->max_decrement <= 0)) ||
(config_ptr->upper_hr_threshold >= (double)1.0f))
(config_ptr->upper_hr_threshold >= 1.0))
cache_ptr->size_decrease_possible = FALSE;
break;

Expand Down Expand Up @@ -3793,8 +3793,8 @@ H5C_unprotect(H5F_t *f, haddr_t addr, void *thing, unsigned flags)
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL,
"initial_size must be in the interval [min_size, max_size]")

if ((config_ptr->min_clean_fraction < (double)0.0f) ||
(config_ptr->min_clean_fraction > (double)1.0f))
if ((config_ptr->min_clean_fraction < 0.0) ||
(config_ptr->min_clean_fraction > 1.0))
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL,
"min_clean_fraction must be in the interval [0.0, 1.0]")

Expand All @@ -3810,12 +3810,12 @@ H5C_unprotect(H5F_t *f, haddr_t addr, void *thing, unsigned flags)
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "Invalid incr_mode")

if (config_ptr->incr_mode == H5C_incr__threshold) {
if ((config_ptr->lower_hr_threshold < (double)0.0f) ||
(config_ptr->lower_hr_threshold > (double)1.0f))
if ((config_ptr->lower_hr_threshold < 0.0) ||
(config_ptr->lower_hr_threshold > 1.0))
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL,
"lower_hr_threshold must be in the range [0.0, 1.0]")

if (config_ptr->increment < (double)1.0f)
if (config_ptr->increment < 1.0)
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL,
"increment must be greater than or equal to 1.0")

Expand All @@ -3830,12 +3830,12 @@ H5C_unprotect(H5F_t *f, haddr_t addr, void *thing, unsigned flags)
break;

case H5C_flash_incr__add_space:
if ((config_ptr->flash_multiple < (double)0.1f) ||
(config_ptr->flash_multiple > (double)10.0f))
if ((config_ptr->flash_multiple < 0.1) ||
(config_ptr->flash_multiple > 10.0))
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL,
"flash_multiple must be in the range [0.1, 10.0]")
if ((config_ptr->flash_threshold < (double)0.1f) ||
(config_ptr->flash_threshold > (double)1.0f))
if ((config_ptr->flash_threshold < 0.1) ||
(config_ptr->flash_threshold > 1.0))
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL,
"flash_threshold must be in the range [0.1, 1.0]")
break;
Expand All @@ -3856,10 +3856,10 @@ H5C_unprotect(H5F_t *f, haddr_t addr, void *thing, unsigned flags)
}

if (config_ptr->decr_mode == H5C_decr__threshold) {
if (config_ptr->upper_hr_threshold > (double)1.0f)
if (config_ptr->upper_hr_threshold > 1.0)
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "upper_hr_threshold must be <= 1.0")

if ((config_ptr->decrement > (double)1.0f) || (config_ptr->decrement < (double)0.0f))
if ((config_ptr->decrement > 1.0) || (config_ptr->decrement < 0.0))
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "decrement must be in the interval [0.0, 1.0]")

/* no need to check max_decrement as it is a size_t
Expand All @@ -3875,8 +3875,8 @@ H5C_unprotect(H5F_t *f, haddr_t addr, void *thing, unsigned flags)
if (config_ptr->epochs_before_eviction > H5C__MAX_EPOCH_MARKERS)
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "epochs_before_eviction too big")

if ((config_ptr->apply_empty_reserve) && ((config_ptr->empty_reserve > (double)1.0f) ||
(config_ptr->empty_reserve < (double)0.0f)))
if ((config_ptr->apply_empty_reserve) && ((config_ptr->empty_reserve > 1.0) ||
(config_ptr->empty_reserve < 0.0)))
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL,
"empty_reserve must be in the interval [0.0, 1.0]")

Expand All @@ -3886,8 +3886,8 @@ H5C_unprotect(H5F_t *f, haddr_t addr, void *thing, unsigned flags)
} /* H5C_decr__age_out || H5C_decr__age_out_with_threshold */

if (config_ptr->decr_mode == H5C_decr__age_out_with_threshold) {
if ((config_ptr->upper_hr_threshold > (double)1.0f) ||
(config_ptr->upper_hr_threshold < (double)0.0f))
if ((config_ptr->upper_hr_threshold > 1.0) ||
(config_ptr->upper_hr_threshold < 0.0))
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL,
"upper_hr_threshold must be in the interval [0.0, 1.0]")
} /* H5C_decr__age_out_with_threshold */
Expand Down Expand Up @@ -4352,8 +4352,8 @@ H5C__pin_entry_from_client(H5C_t H5_ATTR_UNUSED *cache_ptr, H5C_cache_entry_t *e
HDassert(cache_ptr);
HDassert(cache_ptr->magic == H5C__H5C_T_MAGIC);
HDassert(cache_ptr->cache_accesses >= (cache_ptr->resize_ctl).epoch_length);
HDassert((double)0.0f <= (cache_ptr->resize_ctl).min_clean_fraction);
HDassert((cache_ptr->resize_ctl).min_clean_fraction <= (double)100.0f);
HDassert(0.0 <= (cache_ptr->resize_ctl).min_clean_fraction);
HDassert((cache_ptr->resize_ctl).min_clean_fraction <= 100.0);

/* check to see if cache_ptr->resize_in_progress is TRUE. If it, this
* is a re-entrant call via a client callback called in the resize
Expand All @@ -4376,7 +4376,7 @@ H5C__pin_entry_from_client(H5C_t H5_ATTR_UNUSED *cache_ptr, H5C_cache_entry_t *e
if (H5C_get_cache_hit_rate(cache_ptr, &hit_rate) != SUCCEED)
HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "Can't get hit rate")

HDassert(((double)0.0f <= hit_rate) && (hit_rate <= (double)1.0f));
HDassert((0.0 <= hit_rate) && (hit_rate <= 1.0));

switch ((cache_ptr->resize_ctl).incr_mode) {
case H5C_incr__off:
Expand Down
23 changes: 11 additions & 12 deletions src/H5Cdbg.c
Original file line number Diff line number Diff line change
Expand Up @@ -517,11 +517,11 @@ H5C_stats(H5C_t *cache_ptr, const char *cache_name,
int32_t aggregate_max_pins = 0;
double hit_rate;
double prefetch_use_rate;
double average_successful_search_depth = 0.0f;
double average_failed_search_depth = 0.0f;
double average_entries_skipped_per_calls_to_msic = 0.0f;
double average_dirty_pf_entries_skipped_per_call_to_msic = 0.0f;
double average_entries_scanned_per_calls_to_msic = 0.0f;
double average_successful_search_depth = 0.0;
double average_failed_search_depth = 0.0;
double average_entries_skipped_per_calls_to_msic = 0.0;
double average_dirty_pf_entries_skipped_per_call_to_msic = 0.0;
double average_entries_scanned_per_calls_to_msic = 0.0;
#endif /* H5C_COLLECT_CACHE_STATS */
herr_t ret_value = SUCCEED; /* Return value */

Expand Down Expand Up @@ -580,9 +580,9 @@ H5C_stats(H5C_t *cache_ptr, const char *cache_name,
} /* end for */

if ((total_hits > 0) || (total_misses > 0))
hit_rate = (double)100.0f * ((double)(total_hits)) / ((double)(total_hits + total_misses));
hit_rate = 100.0 * ((double)(total_hits)) / ((double)(total_hits + total_misses));
else
hit_rate = 0.0f;
hit_rate = 0.0;

if (cache_ptr->successful_ht_searches > 0)
average_successful_search_depth = ((double)(cache_ptr->total_successful_ht_search_depth)) /
Expand Down Expand Up @@ -718,10 +718,9 @@ H5C_stats(H5C_t *cache_ptr, const char *cache_name,
(long long)(cache_ptr->evictions[H5AC_PREFETCHED_ENTRY_ID]));

if (cache_ptr->prefetches > 0)
prefetch_use_rate =
(double)100.0f * ((double)(cache_ptr->prefetch_hits)) / ((double)(cache_ptr->prefetches));
prefetch_use_rate = 100.0 * ((double)(cache_ptr->prefetch_hits)) / ((double)(cache_ptr->prefetches));
else
prefetch_use_rate = 0.0f;
prefetch_use_rate = 0.0;

HDfprintf(stdout, "%s prefetched entry use rate = %lf\n", cache_ptr->prefix, prefetch_use_rate);

Expand All @@ -746,10 +745,10 @@ H5C_stats(H5C_t *cache_ptr, const char *cache_name,
((cache_ptr->class_table_ptr))[i]->name);

if ((cache_ptr->hits[i] > 0) || (cache_ptr->misses[i] > 0))
hit_rate = (double)100.0f * ((double)(cache_ptr->hits[i])) /
hit_rate = 100.0 * ((double)(cache_ptr->hits[i])) /
((double)(cache_ptr->hits[i] + cache_ptr->misses[i]));
else
hit_rate = 0.0f;
hit_rate = 0.0;

HDfprintf(stdout, "%s hits / misses / hit_rate = %ld / %ld / %f\n", cache_ptr->prefix,
(long)(cache_ptr->hits[i]), (long)(cache_ptr->misses[i]), hit_rate);
Expand Down
9 changes: 4 additions & 5 deletions src/H5Cimage.c
Original file line number Diff line number Diff line change
Expand Up @@ -971,15 +971,14 @@ H5C_image_stats(H5C_t *cache_ptr, hbool_t H5_ATTR_UNUSED print_header)
} /* end for */

if ((total_hits > 0) || (total_misses > 0))
hit_rate = (double)100.0f * ((double)(total_hits)) / ((double)(total_hits + total_misses));
hit_rate = 100.0 * ((double)(total_hits)) / ((double)(total_hits + total_misses));
else
hit_rate = 0.0f;
hit_rate = 0.0;

if (cache_ptr->prefetches > 0)
prefetch_use_rate =
(double)100.0f * ((double)(cache_ptr->prefetch_hits)) / ((double)(cache_ptr->prefetches));
prefetch_use_rate = 100.0 * ((double)(cache_ptr->prefetch_hits)) / ((double)(cache_ptr->prefetches));
else
prefetch_use_rate = 0.0f;
prefetch_use_rate = 0.0;

if (print_header) {
HDfprintf(stdout, "\nhit prefetches prefetch image pf hit\n");
Expand Down
16 changes: 8 additions & 8 deletions src/H5Cprivate.h
Original file line number Diff line number Diff line change
Expand Up @@ -109,20 +109,20 @@
#define H5C__CURR_CACHE_IMAGE_CTL_VER 1

/* Default configuration settings */
#define H5C__DEF_AR_UPPER_THRESHHOLD 0.9999f
#define H5C__DEF_AR_LOWER_THRESHHOLD 0.9f
#define H5C__DEF_AR_UPPER_THRESHHOLD 0.9999
#define H5C__DEF_AR_LOWER_THRESHHOLD 0.9
#define H5C__DEF_AR_MAX_SIZE ((size_t)(16 * 1024 * 1024))
#define H5C__DEF_AR_INIT_SIZE ((size_t)(1 * 1024 * 1024))
#define H5C__DEF_AR_MIN_SIZE ((size_t)(1 * 1024 * 1024))
#define H5C__DEF_AR_MIN_CLEAN_FRAC 0.5f
#define H5C__DEF_AR_INCREMENT 2.0f
#define H5C__DEF_AR_MIN_CLEAN_FRAC 0.5
#define H5C__DEF_AR_INCREMENT 2.0
#define H5C__DEF_AR_MAX_INCREMENT ((size_t)(2 * 1024 * 1024))
#define H5C__DEF_AR_FLASH_MULTIPLE 1.0f
#define H5C__DEV_AR_FLASH_THRESHOLD 0.25f
#define H5C__DEF_AR_DECREMENT 0.9f
#define H5C__DEF_AR_FLASH_MULTIPLE 1.0
#define H5C__DEV_AR_FLASH_THRESHOLD 0.25
#define H5C__DEF_AR_DECREMENT 0.9
#define H5C__DEF_AR_MAX_DECREMENT ((size_t)(1 * 1024 * 1024))
#define H5C__DEF_AR_EPCHS_B4_EVICT 3
#define H5C__DEF_AR_EMPTY_RESERVE 0.05f
#define H5C__DEF_AR_EMPTY_RESERVE 0.05
#define H5C__MIN_AR_EPOCH_LENGTH 100
#define H5C__DEF_AR_EPOCH_LENGTH 50000
#define H5C__MAX_AR_EPOCH_LENGTH 1000000
Expand Down
2 changes: 1 addition & 1 deletion src/H5HFdbg.c
Original file line number Diff line number Diff line change
Expand Up @@ -543,7 +543,7 @@ H5HF_dblock_debug(H5F_t *f, haddr_t addr, FILE *stream, int indent, int fwidth,
amount_free = 0;

HDfprintf(stream, "%*s%-*s %.2f%%\n", indent, "", fwidth, "Percent of available space for data used:",
((double)100.0f * (double)((dblock->size - blk_prefix_size) - amount_free) /
(100.0 * (double)((dblock->size - blk_prefix_size) - amount_free) /
(double)(dblock->size - blk_prefix_size)));

/*
Expand Down
2 changes: 1 addition & 1 deletion src/H5HLdbg.c
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ BEGIN_FUNC(PRIV, ERR, herr_t, SUCCEED, FAIL,

if (h->dblk_size)
HDfprintf(stream, "%*s%-*s %.2f%%\n", indent, "", fwidth, "Percent of heap used:",
((double)100.0f * (double)(h->dblk_size - amount_free) / (double)h->dblk_size));
(100.0 * (double)(h->dblk_size - amount_free) / (double)h->dblk_size));

/* Print the data in a VMS-style octal dump */
H5_buffer_dump(stream, indent, h->dblk_image, marker, (size_t)0, h->dblk_size);
Expand Down
2 changes: 1 addition & 1 deletion src/H5Pdapl.c
Original file line number Diff line number Diff line change
Expand Up @@ -768,7 +768,7 @@ H5Pset_chunk_cache(hid_t dapl_id, size_t rdcc_nslots, size_t rdcc_nbytes, double

/* Check arguments. Note that we allow negative values - they are
* considered to "unset" the property. */
if (rdcc_w0 > (double)1.0f)
if (rdcc_w0 > 1.0)
HGOTO_ERROR(
H5E_ARGS, H5E_BADVALUE, FAIL,
"raw data cache w0 value must be between 0.0 and 1.0 inclusive, or H5D_CHUNK_CACHE_W0_DEFAULT");
Expand Down
5 changes: 2 additions & 3 deletions src/H5Pdxpl.c
Original file line number Diff line number Diff line change
Expand Up @@ -1486,9 +1486,8 @@ H5Pset_btree_ratios(hid_t plist_id, double left, double middle, double right)
H5TRACE4("e", "iddd", plist_id, left, middle, right);

/* Check arguments */
if (left < (double)0.0f || left > (double)1.0f || middle < (double)0.0f || middle > (double)1.0f ||
right < (double)0.0f || right > (double)1.0f)
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "split ratio must satisfy 0.0<=X<=1.0")
if (left < 0.0 || left > 1.0 || middle < 0.0 || middle > 1.0 || right < 0.0 || right > 1.0)
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "split ratio must satisfy 0.0 <= X <= 1.0")

/* Get the plist structure */
if (NULL == (plist = H5P_object_verify(plist_id, H5P_DATASET_XFER)))
Expand Down
2 changes: 1 addition & 1 deletion src/H5Pfapl.c
Original file line number Diff line number Diff line change
Expand Up @@ -1708,7 +1708,7 @@ H5Pset_cache(hid_t plist_id, int H5_ATTR_UNUSED mdc_nelmts, size_t rdcc_nslots,
H5TRACE5("e", "iIszzd", plist_id, mdc_nelmts, rdcc_nslots, rdcc_nbytes, rdcc_w0);

/* Check arguments */
if (rdcc_w0 < (double)0.0f || rdcc_w0 > (double)1.0f)
if (rdcc_w0 < 0.0 || rdcc_w0 > 1.0)
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL,
"raw data cache w0 value must be between 0.0 and 1.0 inclusive")

Expand Down
4 changes: 2 additions & 2 deletions src/H5T.c
Original file line number Diff line number Diff line change
Expand Up @@ -561,8 +561,8 @@ size_t H5T_NATIVE_UINT_FAST64_ALIGN_g = 0;
/* (+/- Inf for all floating-point types) */
float H5T_NATIVE_FLOAT_POS_INF_g = 0.0f;
float H5T_NATIVE_FLOAT_NEG_INF_g = 0.0f;
double H5T_NATIVE_DOUBLE_POS_INF_g = (double)0.0f;
double H5T_NATIVE_DOUBLE_NEG_INF_g = (double)0.0f;
double H5T_NATIVE_DOUBLE_POS_INF_g = 0.0;
double H5T_NATIVE_DOUBLE_NEG_INF_g = 0.0;

/* Declare the free list for H5T_t's and H5T_shared_t's */
H5FL_DEFINE(H5T_t);
Expand Down
2 changes: 1 addition & 1 deletion src/H5Zdeflate.c
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ const H5Z_class2_t H5Z_DEFLATE[1] = {{
H5Z__filter_deflate, /* The actual filter function */
}};

#define H5Z_DEFLATE_SIZE_ADJUST(s) (HDceil(((double)(s)) * (double)1.001f) + 12)
#define H5Z_DEFLATE_SIZE_ADJUST(s) (HDceil(((double)(s)) * 1.001) + 12)

/*-------------------------------------------------------------------------
* Function: H5Z__filter_deflate
Expand Down
2 changes: 1 addition & 1 deletion src/H5Zscaleoffset.c
Original file line number Diff line number Diff line change
Expand Up @@ -1116,7 +1116,7 @@ H5Z__filter_scaleoffset(unsigned flags, size_t cd_nelmts, const unsigned cd_valu
unsigned filavail; /* flag indicating if fill value is defined or not */
H5Z_SO_scale_type_t scale_type = H5Z_SO_FLOAT_DSCALE; /* scale type */
int scale_factor = 0; /* scale factor */
double D_val = 0.0f; /* decimal scale factor */
double D_val = 0.0; /* decimal scale factor */
uint32_t minbits = 0; /* minimum number of bits to store values */
unsigned long long minval = 0; /* minimum value of input buffer */
enum H5Z_scaleoffset_t type; /* memory type corresponding to dataset datatype */
Expand Down
Loading

0 comments on commit 4c3c1e9

Please sign in to comment.