# HG changeset patch # User ramiro # Date 1250189233 0 # Node ID c86488f7f319863f44256d04abc164220e9d8638 # Parent cd95821e8278ac50ed99a2633422a01a46286cf0 Introduce av_clip_uint16(). diff -r cd95821e8278 -r c86488f7f319 common.h --- a/common.h Mon Aug 10 13:42:16 2009 +0000 +++ b/common.h Thu Aug 13 18:47:13 2009 +0000 @@ -190,6 +190,17 @@ } /** + * Clips a signed integer value into the 0-65535 range. + * @param a value to clip + * @return clipped value + */ +static inline av_const uint16_t av_clip_uint16(int a) +{ + if (a&(~65535)) return (-a)>>31; + else return a; +} + +/** * Clips a signed integer value into the -32768,32767 range. * @param a value to clip * @return clipped value