Eliminate GBG-specific initialization, pad syntax with whitespace, try to fix syntax bugs
@@ -579,7 +579,7 @@ nc4_convert_type(const void *src, void *dest, const nc_type src_type,
}
- /* Parameters used only by BitGroom */
+ /* Parameters BitGroom needs to be set once */
if (quantize_mode == NC_QUANTIZE_BITGROOM)
{
@@ -628,26 +628,7 @@ nc4_convert_type(const void *src, void *dest, const nc_type src_type,
}
}
- /* Set-up parameters used only by GranularBG */
- else if (quantize_mode == NC_QUANTIZE_GRANULARBG)
- {
-
- if (dest_type == NC_FLOAT)
- {
-
- bit_xpl_nbr_sgn=BIT_XPL_NBR_SGN_FLT;
-
- }
- else
- {
- bit_xpl_nbr_sgn=BIT_XPL_NBR_SGN_DBL;
-
- }
-
- }
-
- }
} /* endif quantize */
/* OK, this is ugly. If you can think of anything better, I'm open
@@ -1458,7 +1439,7 @@ nc4_convert_type(const void *src, void *dest, const nc_type src_type,
prc_bnr_xpl_rqr = mnt_fabs == 0.0 ? 0 : abs((int)floor(xpn_bs2 - bit_per_dgt*mnt_log10_fabs) - qnt_pwr); /* Protect against mnt = -0.0 */
prc_bnr_xpl_rqr--; /* 20211003 Reduce formula result by 1 bit: Passes all tests, improves CR by ~10% */
- bit_xpl_nbr_zro=bit_xpl_nbr_sgn-prc_bnr_xpl_rqr;
+ bit_xpl_nbr_zro = BIT_XPL_NBR_SGN_FLT - prc_bnr_xpl_rqr;
msk_f32_u32_zro = 0u; /* Zero all bits */
msk_f32_u32_zro = ~msk_f32_u32_zro; /* Turn all bits to ones */
/* Bit Shave mask for AND: Left shift zeros into bits to be rounded, leave ones in untouched bits */
@@ -1492,8 +1473,8 @@ nc4_convert_type(const void *src, void *dest, const nc_type src_type,
prc_bnr_xpl_rqr = mnt_fabs == 0.0 ? 0 : abs((int)floor(xpn_bs2 - bit_per_dgt*mnt_log10_fabs) - qnt_pwr); /* Protect against mnt = -0.0 */
prc_bnr_xpl_rqr--; /* 20211003 Reduce formula result by 1 bit: Passes all tests, improves CR by ~10% */
- bit_xpl_nbr_zro=bit_xpl_nbr_sgn-prc_bnr_xpl_rqr;
- msk_f64_u64_zro=0u; /* Zero all bits */
+ bit_xpl_nbr_zro = BIT_XPL_NBR_SGN_DBL - prc_bnr_xpl_rqr;
+ msk_f64_u64_zro = 0ull; /* Zero all bits */
msk_f64_u64_zro = ~msk_f64_u64_zro; /* Turn all bits to ones */
/* Bit Shave mask for AND: Left shift zeros into bits to be rounded, leave ones in untouched bits */
msk_f64_u64_zro <<= bit_xpl_nbr_zro;
