[FFmpeg-devel] [PATCH 1/3] Add zero_extend() function

Mans Rullgard mans
Sun Feb 21 01:35:57 CET 2010


---
 libavcodec/mathops.h |    7 +++++++
 1 files changed, 7 insertions(+), 0 deletions(-)

diff --git a/libavcodec/mathops.h b/libavcodec/mathops.h
index 85eac48..149910b 100644
--- a/libavcodec/mathops.h
+++ b/libavcodec/mathops.h
@@ -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)) {\
-- 
1.7.0




More information about the ffmpeg-devel mailing list