changeset 9096:005cf8ba225f libavcodec

Add sign_extend() function to mathops.h
author mru
date Tue, 03 Mar 2009 00:03:55 +0000
parents 50e847b72cdd
children b2f29d9da737
files mathops.h
diffstat 1 files changed, 7 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/mathops.h	Mon Mar 02 19:42:31 2009 +0000
+++ b/mathops.h	Tue Mar 03 00:03:55 2009 +0000
@@ -113,5 +113,12 @@
 }
 #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 */