comparison internal.h @ 481:f4187c1c15a6 libavutil

Reapply r12489: Add pure, const and malloc attributes to proper functions in libavutil. Fix a compilation failure in r12489.
author zuxy
date Wed, 19 Mar 2008 06:17:43 +0000
parents 8d2c05ebf5f1
children 9df3dec6f840
comparison
equal deleted inserted replaced
480:c4ce55ea2c04 481:f4187c1c15a6
170 170
171 extern const uint8_t ff_sqrt_tab[256]; 171 extern const uint8_t ff_sqrt_tab[256];
172 172
173 static inline int av_log2_16bit(unsigned int v); 173 static inline int av_log2_16bit(unsigned int v);
174 174
175 static inline unsigned int ff_sqrt(unsigned int a) 175 static inline av_const unsigned int ff_sqrt(unsigned int a)
176 { 176 {
177 unsigned int b; 177 unsigned int b;
178 178
179 if(a<255) return (ff_sqrt_tab[a+1]-1)>>4; 179 if(a<255) return (ff_sqrt_tab[a+1]-1)>>4;
180 else if(a<(1<<12)) b= ff_sqrt_tab[a>>4 ]>>2; 180 else if(a<(1<<12)) b= ff_sqrt_tab[a>>4 ]>>2;
265 goto fail;\ 265 goto fail;\
266 }\ 266 }\
267 } 267 }
268 268
269 #ifndef HAVE_LLRINT 269 #ifndef HAVE_LLRINT
270 static av_always_inline long long llrint(double x) 270 static av_always_inline av_const long long llrint(double x)
271 { 271 {
272 return rint(x); 272 return rint(x);
273 } 273 }
274 #endif /* HAVE_LLRINT */ 274 #endif /* HAVE_LLRINT */
275 275
276 #ifndef HAVE_LRINT 276 #ifndef HAVE_LRINT
277 static av_always_inline long int lrint(double x) 277 static av_always_inline av_const long int lrint(double x)
278 { 278 {
279 return rint(x); 279 return rint(x);
280 } 280 }
281 #endif /* HAVE_LRINT */ 281 #endif /* HAVE_LRINT */
282 282
283 #ifndef HAVE_LRINTF 283 #ifndef HAVE_LRINTF
284 static av_always_inline long int lrintf(float x) 284 static av_always_inline av_const long int lrintf(float x)
285 { 285 {
286 return (int)(rint(x)); 286 return (int)(rint(x));
287 } 287 }
288 #endif /* HAVE_LRINTF */ 288 #endif /* HAVE_LRINTF */
289 289
290 #ifndef HAVE_ROUND 290 #ifndef HAVE_ROUND
291 static av_always_inline double round(double x) 291 static av_always_inline av_const double round(double x)
292 { 292 {
293 return (x > 0) ? floor(x + 0.5) : ceil(x - 0.5); 293 return (x > 0) ? floor(x + 0.5) : ceil(x - 0.5);
294 } 294 }
295 #endif /* HAVE_ROUND */ 295 #endif /* HAVE_ROUND */
296 296
297 #ifndef HAVE_ROUNDF 297 #ifndef HAVE_ROUNDF
298 static av_always_inline float roundf(float x) 298 static av_always_inline av_const float roundf(float x)
299 { 299 {
300 return (x > 0) ? floor(x + 0.5) : ceil(x - 0.5); 300 return (x > 0) ? floor(x + 0.5) : ceil(x - 0.5);
301 } 301 }
302 #endif /* HAVE_ROUNDF */ 302 #endif /* HAVE_ROUNDF */
303 303