Add zero_extend() function
authorMåns Rullgård <mans@mansr.com>
Sun, 21 Feb 2010 21:48:37 +0000 (21:48 +0000)
committerMåns Rullgård <mans@mansr.com>
Sun, 21 Feb 2010 21:48:37 +0000 (21:48 +0000)
Originally committed as revision 21947 to svn://svn.ffmpeg.org/ffmpeg/trunk

libavcodec/mathops.h

index 85eac48..149910b 100644 (file)
@@ -122,6 +122,13 @@ static inline av_const int sign_extend(int val, unsigned bits)
 }
 #endif
 
+#ifndef zero_extend
+static inline av_const unsigned zero_extend(unsigned val, unsigned bits)
+{
+    return (val << (INT_BIT - bits)) >> (INT_BIT - bits);
+}
+#endif
+
 #ifndef COPY3_IF_LT
 #define COPY3_IF_LT(x, y, a, b, c, d)\
 if ((y) < (x)) {\