# HG changeset patch # User aurel # Date 1146443244 0 # Node ID c25cab283094bbac2ddc6315a2987dff63aba91e # Parent e7df68ba31a220ef2f420f74bc79e34572003b4c document clip functions diff -r e7df68ba31a2 -r c25cab283094 common.h --- a/common.h Sun Apr 30 17:49:11 2006 +0000 +++ b/common.h Mon May 01 00:27:24 2006 +0000 @@ -427,6 +427,13 @@ #endif } +/** + * clip a signed integer value into the amin-amax range + * @param a value to clip + * @param amin minimum value of the clip range + * @param amax maximum value of the clip range + * @return cliped value + */ static inline int clip(int a, int amin, int amax) { if (a < amin) @@ -437,6 +444,11 @@ return a; } +/** + * clip a signed integer value into the 0-255 range + * @param a value to clip + * @return cliped value + */ static inline uint8_t clip_uint8(int a) { if (a&(~255)) return (-a)>>31;