]> git.sesse.net Git - ffmpeg/blobdiff - libavcodec/mathops.h
dxa: remove useless code
[ffmpeg] / libavcodec / mathops.h
index ec76eaae291d53bc1b42aa1b7b3c261b48c5df41..d6eb98ddac586f39c0b489a3cd2e62c488ba9b98 100644 (file)
@@ -116,7 +116,9 @@ static inline av_const int mid_pred(int a, int b, int c)
 #ifndef sign_extend
 static inline av_const int sign_extend(int val, unsigned bits)
 {
-    return (val << ((8 * sizeof(int)) - bits)) >> ((8 * sizeof(int)) - bits);
+    unsigned shift = 8 * sizeof(int) - bits;
+    union { unsigned u; int s; } v = { (unsigned) val << shift };
+    return v.s >> shift;
 }
 #endif
 
@@ -177,4 +179,3 @@ if ((y) < (x)) {\
 #endif
 
 #endif /* AVCODEC_MATHOPS_H */
-