Mercurial > libavutil.hg
diff common.h @ 764:c86488f7f319 libavutil
Introduce av_clip_uint16().
author | ramiro |
---|---|
date | Thu, 13 Aug 2009 18:47:13 +0000 |
parents | 58d118a78f6d |
children | 8848af31706f |
line wrap: on
line diff
--- 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