Re: CLAMP()



Davina Armstrong <davina lickey com> writes:

What does CLAMP() do?  I've grep'd the code, but I can't even figure out
where it's defined.

it's defined in glib.h

#define CLAMP(x, low, high)  (((x) > (high)) ? (high) : (((x) < (low)) ? (low) : (x)))

CLAMP (5, 0, 10) == 5
CLAMP (-100, 0, 10) == 0
CLAMP (100, 0, 10) == 10

-Jonathan




[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]