sys: util: Replace MIN(MAX(a, b), c) with CLAMP
Replaces all existing variants of value clamping with the MIN and MAX macros with the CLAMP macro. Signed-off-by: Trond Einar Snekvik <Trond.Einar.Snekvik@nordicsemi.no>
This commit is contained in:
parent
ed1f75da74
commit
86c793af3f
16 changed files with 19 additions and 19 deletions
|
@ -165,7 +165,7 @@ void z_clock_set_timeout(int32_t ticks, bool idle)
|
|||
}
|
||||
|
||||
ticks = ticks == K_TICKS_FOREVER ? max_ticks : ticks;
|
||||
ticks = MAX(MIN(ticks - 1, (int32_t)max_ticks), 0);
|
||||
ticks = CLAMP(ticks - 1, 0, (int32_t)max_ticks);
|
||||
|
||||
k_spinlock_key_t key = k_spin_lock(&lock);
|
||||
uint32_t now = MAIN_COUNTER_REG, cyc, adj;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue