mirror of
https://github.com/espressif/esp-idf.git
synced 2024-10-05 20:47:46 -04: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:
commit
3a04b712fa
@ -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;
|
||||
}
|
||||
|
@ -123,7 +123,7 @@ TEST_CASE("getting the time works", "[test_utils][ccomp_timer]")
|
||||
int64_t t_2 = esp_timer_get_time() - start;
|
||||
|
||||
// The times should at least be in the same ballpark (at least within 10%)
|
||||
float diff = (abs(t_1 - t_2)) / ((float)t_2);
|
||||
float diff = (llabs(t_1 - t_2)) / ((float)t_2);
|
||||
TEST_ASSERT(diff <= 10.0f);
|
||||
|
||||
// Since the timer was already stopped, test that ccomp_timer_get_time
|
||||
|
@ -162,7 +162,7 @@ TEST_CASE("data cache hit rate sweep", "[test_utils][ccomp_timer]")
|
||||
for (int i = 0; i <= 100; i += 5)
|
||||
{
|
||||
t_hr = perform_test_at_hit_rate(i, flash_mem);
|
||||
float error = (abs(t_ref.ccomp - t_hr.ccomp) / (float)t_ref.ccomp) * 100.0f;
|
||||
float error = (llabs(t_ref.ccomp - t_hr.ccomp) / (float)t_ref.ccomp) * 100.0f;
|
||||
|
||||
ESP_LOGI(TAG, "Hit Rate(%%): %d Wall Time(us): %lld Compensated Time(us): %lld Error(%%): %f", i, (long long)t_hr.wall, (long long)t_hr.ccomp, error);
|
||||
|
||||
|
@ -221,7 +221,7 @@ TEST_CASE("instruction cache hit rate sweep test", "[test_utils][ccomp_timer]")
|
||||
for (int i = 0; i <= 100; i += 5)
|
||||
{
|
||||
t_hr = perform_test_at_hit_rate(i);
|
||||
float error = (abs(t_ref.ccomp - t_hr.ccomp) / (float)t_ref.wall) * 100.0f;
|
||||
float error = (llabs(t_ref.ccomp - t_hr.ccomp) / (float)t_ref.wall) * 100.0f;
|
||||
|
||||
ESP_LOGI(TAG, "Hit Rate(%%): %d Wall Time(us): %lld Compensated Time(us): %lld Error(%%): %f", i, (long long)t_hr.wall, (long long)t_hr.ccomp, error);
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user