From: Måns Rullgård Date: Tue, 3 Mar 2009 00:03:55 +0000 (+0000) Subject: Add sign_extend() function to mathops.h X-Git-Tag: v0.6~5579 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=101dfa7d0a15de14c599a9c5db9945419fd12fb9;p=platform%2Fupstream%2Flibav.git Add sign_extend() function to mathops.h Originally committed as revision 17738 to svn://svn.ffmpeg.org/ffmpeg/trunk --- diff --git a/libavcodec/mathops.h b/libavcodec/mathops.h index 880e94671..b92a6be13 100644 --- a/libavcodec/mathops.h +++ b/libavcodec/mathops.h @@ -113,5 +113,12 @@ static inline av_const int mid_pred(int a, int b, int c) } #endif +#ifndef sign_extend +static inline av_const int sign_extend(int val, unsigned bits) +{ + return (val << (INT_BIT - bits)) >> (INT_BIT - bits); +} +#endif + #endif /* AVCODEC_MATHOPS_H */