diff --git a/include/cmp_support.h b/include/cmp_support.h index 105a9da9d4e0dc200991b47e085b76d805caaefe..2f830414711c3afb8bc0038357c9f7a64a17a3fb 100644 --- a/include/cmp_support.h +++ b/include/cmp_support.h @@ -262,6 +262,32 @@ struct fx_cob_par { }; +/** + * @brief method for lossy rounding + * @note This function is implemented as a macro for the sake of performance + * + * @param value the value to round + * @param round rounding parameter + * + * @return rounded value + */ + +#define round_fwd(value, round) ((uint32_t)(value) << (round)) + + +/** + * @brief inverse method for lossy rounding + * @note This function is implemented as a macro for the sake of performance + * + * @param value the value to round back + * @param round rounding parameter + * + * @return back rounded value + */ + +#define round_inv(value, round) ((uint32_t)(value) << (round)) + + int is_a_pow_of_2(unsigned int v); int ilog_2(uint32_t x); @@ -291,8 +317,8 @@ int rdcu_supported_cmp_mode_is_used(enum cmp_mode cmp_mode); int zero_escape_mech_is_used(enum cmp_mode cmp_mode); int multi_escape_mech_is_used(enum cmp_mode cmp_mode); -unsigned int round_fwd(unsigned int value, unsigned int round); -unsigned int round_inv(unsigned int value, unsigned int round); +/* unsigned int round_fwd(unsigned int value, unsigned int round); */ +/* unsigned int round_inv(unsigned int value, unsigned int round); */ unsigned int cmp_up_model(unsigned int data, unsigned int model, unsigned int model_value, unsigned int round); diff --git a/lib/cmp_support.c b/lib/cmp_support.c index dea1e6f2f34bafae8ebb1589fd8aedad0a039e34..e718ba4ab9bd27b99134b411389cb285a8c93adb 100644 --- a/lib/cmp_support.c +++ b/lib/cmp_support.c @@ -312,36 +312,6 @@ int cmp_aux_data_type_is_used(enum cmp_data_type data_type) } -/** - * @brief method for lossy rounding - * - * @param value the value to round - * @param round rounding parameter - * - * @return rounded value - */ - -unsigned int round_fwd(unsigned int value, unsigned int round) -{ - return value >> round; -} - - -/** - * @brief inverse method for lossy rounding - * - * @param value the value to round back - * @param round rounding parameter - * - * @return back rounded value - */ - -unsigned int round_inv(unsigned int value, unsigned int round) -{ - return value << round; -} - - /** * @brief implantation of the model update equation * @note check before that model_value is not greater than MAX_MODEL_VALUE