hv: add clamp macro for convenience
Add clamp macro to clamp a value within a range. Tracked-On: #8500 Reviewed-by: Junjie Mao <junjie.mao@intel.com> Signed-off-by: Qiang Zhang <qiang4.zhang@intel.com>
This commit is contained in:
parent
9a6e940849
commit
c000a3f70b
|
@ -22,6 +22,9 @@
|
|||
|
||||
#define max(x, y) (((x) < (y)) ? (y) : (x))
|
||||
|
||||
/** return a value of v clamped to the range [l, h] */
|
||||
#define clamp(v, l, h) (max(min((v), (h)), (l)))
|
||||
|
||||
/** Replaces 'x' by the string "x". */
|
||||
#define STRINGIFY(x) #x
|
||||
|
||||
|
|
Loading…
Reference in New Issue