CARB_CLAMP

Defined in carb/Defines.h

CARB_CLAMP(x, lo, hi)

A macro the returns the largest of two values.

Warning

This macro will evaluate parameters more than once! Consider using std::clamp or an inline function instead.

Parameters
  • x – The value to clamp.

  • lo – The lowest acceptable value. This will be returned if x < lo.

  • hi – The highest acceptable value. This will be returned if x > hi.

Returns

lo if x is less than lo; hi if x is greater than hi; x otherwise.