components: correct abs() use for unsigned argument

This commit is contained in:
Anton Maklakov 2022-03-31 15:52:46 +07:00
parent 56914d3c81
commit 7a066b7b56
5 changed files with 8 additions and 8 deletions

View File

@ -292,7 +292,7 @@ static inline void i2s_ll_tx_set_mclk(i2s_dev_t *hw, uint32_t sclk, uint32_t mcl
int denominator = 1;
int numerator = 0;
uint32_t freq_diff = abs(sclk - mclk * mclk_div);
uint32_t freq_diff = abs((int)sclk - (int)(mclk * mclk_div));
if (!freq_diff) {
goto finish;
}

View File

@ -232,7 +232,7 @@ static inline void i2s_ll_tx_set_mclk(i2s_dev_t *hw, uint32_t sclk, uint32_t mcl
int denominator = 1;
int numerator = 0;
uint32_t freq_diff = abs(sclk - mclk * mclk_div);
uint32_t freq_diff = abs((int)sclk - (int)(mclk * mclk_div));
if (!freq_diff) {
goto finish;
}
@ -306,7 +306,7 @@ static inline void i2s_ll_rx_set_mclk(i2s_dev_t *hw, uint32_t sclk, uint32_t mcl
int denominator = 1;
int numerator = 0;
uint32_t freq_diff = abs(sclk - mclk * mclk_div);
uint32_t freq_diff = abs((int)sclk - (int)(mclk * mclk_div));
if (!freq_diff) {
goto finish;
}

View File

@ -233,7 +233,7 @@ static inline void i2s_ll_tx_set_mclk(i2s_dev_t *hw, uint32_t sclk, uint32_t mcl
int denominator = 1;
int numerator = 0;
uint32_t freq_diff = abs(sclk - mclk * mclk_div);
uint32_t freq_diff = abs((int)sclk - (int)(mclk * mclk_div));
if (!freq_diff) {
goto finish;
}
@ -307,7 +307,7 @@ static inline void i2s_ll_rx_set_mclk(i2s_dev_t *hw, uint32_t sclk, uint32_t mcl
int denominator = 1;
int numerator = 0;
uint32_t freq_diff = abs(sclk - mclk * mclk_div);
uint32_t freq_diff = abs((int)sclk - (int)(mclk * mclk_div));
if (!freq_diff) {
goto finish;
}

View File

@ -287,7 +287,7 @@ static inline void i2s_ll_tx_set_mclk(i2s_dev_t *hw, uint32_t sclk, uint32_t mcl
int denominator = 1;
int numerator = 0;
uint32_t freq_diff = abs(sclk - mclk * mclk_div);
uint32_t freq_diff = abs((int)sclk - (int)(mclk * mclk_div));
if (!freq_diff) {
goto finish;
}

View File

@ -235,7 +235,7 @@ static inline void i2s_ll_tx_set_mclk(i2s_dev_t *hw, uint32_t sclk, uint32_t mcl
int denominator = 1;
int numerator = 0;
uint32_t freq_diff = abs(sclk - mclk * mclk_div);
uint32_t freq_diff = abs((int)sclk - (int)(mclk * mclk_div));
if (!freq_diff) {
goto finish;
}
@ -309,7 +309,7 @@ static inline void i2s_ll_rx_set_mclk(i2s_dev_t *hw, uint32_t sclk, uint32_t mcl
int denominator = 1;
int numerator = 0;
uint32_t freq_diff = abs(sclk - mclk * mclk_div);
uint32_t freq_diff = abs((int)sclk - (int)(mclk * mclk_div));
if (!freq_diff) {
goto finish;
}