mirror of
https://github.com/espressif/esp-idf.git
synced 2025-12-06 00:59:30 +01:00
Merge branch 'bugfix/fix_abs_using' into 'master'
build: fix abs() use See merge request espressif/esp-idf!16952
This commit is contained in:
@@ -311,7 +311,7 @@ static esp_err_t emac_config_apll_clock(void)
|
||||
ESP_LOGW(TAG, "APLL is occupied already, it is working at %d Hz", real_freq);
|
||||
}
|
||||
// If the difference of real APLL frequency is not within 50 ppm, i.e. 2500 Hz, the APLL is unavailable
|
||||
ESP_RETURN_ON_FALSE(abs(real_freq - expt_freq) <= 2500,
|
||||
ESP_RETURN_ON_FALSE(abs((int)real_freq - (int)expt_freq) <= 2500,
|
||||
ESP_ERR_INVALID_STATE, TAG, "The APLL is working at an unusable frequency");
|
||||
|
||||
return ESP_OK;
|
||||
|
||||
@@ -249,7 +249,7 @@ void IRAM_ATTR esp_timer_impl_set_alarm_id(uint64_t timestamp, unsigned alarm_id
|
||||
(the alarm will be less than the counter) and it leads to the infinity loop.
|
||||
To exclude this behavior to the offset was added the delta to have the opportunity to go through it.
|
||||
*/
|
||||
offset += abs((int)delta) + s_timer_ticks_per_us * 2;
|
||||
offset += llabs(delta) + s_timer_ticks_per_us * 2;
|
||||
} else {
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -162,7 +162,7 @@ void IRAM_ATTR esp_timer_impl_set_alarm_id(uint64_t timestamp, unsigned alarm_id
|
||||
int64_t delta = (int64_t)alarm.val - (int64_t)now_time;
|
||||
if (delta <= 0 && REG_GET_FIELD(INT_ST_REG, TIMG_LACT_INT_ST) == 0) {
|
||||
// new alarm is less than the counter and the interrupt flag is not set
|
||||
offset += abs((int)delta) + TICKS_PER_US * 2;
|
||||
offset += llabs(delta) + TICKS_PER_US * 2;
|
||||
alarm.val = now_time + offset;
|
||||
} else {
|
||||
// finish if either (alarm > counter) or the interrupt flag is already set.
|
||||
|
||||
@@ -27,7 +27,7 @@ static void i2s_hal_mclk_div_decimal_cal(i2s_hal_clock_cfg_t *clk_cfg, i2s_ll_mc
|
||||
cal->a = 1;
|
||||
cal->b = 0;
|
||||
|
||||
uint32_t freq_diff = abs(clk_cfg->sclk - clk_cfg->mclk * cal->mclk_div);
|
||||
uint32_t freq_diff = abs((int)clk_cfg->sclk - (int)(clk_cfg->mclk * cal->mclk_div));
|
||||
if (!freq_diff) {
|
||||
return;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user