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:
Trond Einar Snekvik 2020-10-27 12:27:25 +01:00 committed by Carles Cufí
commit 86c793af3f
16 changed files with 19 additions and 19 deletions

View file

@ -210,7 +210,7 @@ void z_clock_set_timeout(int32_t ticks, bool idle)
* treated identically: it simply indicates the kernel would like the
* next tick announcement as soon as possible.
*/
ticks = MAX(MIN(ticks - 1, (int32_t)LPTIM_TIMEBASE), 1);
ticks = CLAMP(ticks - 1, 1, (int32_t)LPTIM_TIMEBASE);
k_spinlock_key_t key = k_spin_lock(&lock);