comparison mathops.h @ 11721:969a7d792b79 libavcodec

Use standard C for implementing sign_extend() and zero_extend(). This fixes compilation of probetest
author michael
date Thu, 13 May 2010 16:32:21 +0000
parents c975efe95584
children 2952baf6a266
comparison
equal deleted inserted replaced
11720:92f4ca7a4002 11721:969a7d792b79
116 #endif 116 #endif
117 117
118 #ifndef sign_extend 118 #ifndef sign_extend
119 static inline av_const int sign_extend(int val, unsigned bits) 119 static inline av_const int sign_extend(int val, unsigned bits)
120 { 120 {
121 return (val << (INT_BIT - bits)) >> (INT_BIT - bits); 121 return (val << ((8 * sizeof(int)) - bits)) >> ((8 * sizeof(int)) - bits);
122 } 122 }
123 #endif 123 #endif
124 124
125 #ifndef zero_extend 125 #ifndef zero_extend
126 static inline av_const unsigned zero_extend(unsigned val, unsigned bits) 126 static inline av_const unsigned zero_extend(unsigned val, unsigned bits)
127 { 127 {
128 return (val << (INT_BIT - bits)) >> (INT_BIT - bits); 128 return (val << ((8 * sizeof(int)) - bits)) >> ((8 * sizeof(int)) - bits);
129 } 129 }
130 #endif 130 #endif
131 131
132 #ifndef COPY3_IF_LT 132 #ifndef COPY3_IF_LT
133 #define COPY3_IF_LT(x, y, a, b, c, d)\ 133 #define COPY3_IF_LT(x, y, a, b, c, d)\