comparison internal.h @ 808:1778eea266cb libavutil

Use macros instead of inline functions to replace the following missing C99 functions: exp2, exp2f, log2, log2f. Should fix compilation in systems where these functions are defined in math.h but not implemented.
author vitor
date Sat, 16 Jan 2010 01:27:46 +0000
parents 757914de10e1
children d87093e4b925
comparison
equal deleted inserted replaced
807:36cc11e07d9b 808:1778eea266cb
262 goto label;\ 262 goto label;\
263 }\ 263 }\
264 } 264 }
265 265
266 #if !HAVE_EXP2 266 #if !HAVE_EXP2
267 static av_always_inline av_const double exp2(double x) 267 #undef exp2
268 { 268 #define exp2(x) exp((x) * 0.693147180559945)
269 return exp(x * 0.693147180559945);
270 }
271 #endif /* HAVE_EXP2 */ 269 #endif /* HAVE_EXP2 */
272 270
273 #if !HAVE_EXP2F 271 #if !HAVE_EXP2F
274 static av_always_inline av_const float exp2f(float x) 272 #undef exp2f
275 { 273 #define exp2f(x) exp2(x)
276 return exp2(x);
277 }
278 #endif /* HAVE_EXP2F */ 274 #endif /* HAVE_EXP2F */
279 275
280 #if !HAVE_LLRINT 276 #if !HAVE_LLRINT
281 static av_always_inline av_const long long llrint(double x) 277 static av_always_inline av_const long long llrint(double x)
282 { 278 {
283 return rint(x); 279 return rint(x);
284 } 280 }
285 #endif /* HAVE_LLRINT */ 281 #endif /* HAVE_LLRINT */
286 282
287 #if !HAVE_LOG2 283 #if !HAVE_LOG2
288 static av_always_inline av_const double log2(double x) 284 #undef log2
289 { 285 #define log2(x) (log(x) * 1.44269504088896340736)
290 return log(x) * 1.44269504088896340736;
291 }
292 #endif /* HAVE_LOG2 */ 286 #endif /* HAVE_LOG2 */
293 287
294 #if !HAVE_LOG2F 288 #if !HAVE_LOG2F
295 static av_always_inline av_const float log2f(float x) 289 #undef log2f
296 { 290 #define log2f(x) log2(x)
297 return log2(x);
298 }
299 #endif /* HAVE_LOG2F */ 291 #endif /* HAVE_LOG2F */
300 292
301 #if !HAVE_LRINT 293 #if !HAVE_LRINT
302 static av_always_inline av_const long int lrint(double x) 294 static av_always_inline av_const long int lrint(double x)
303 { 295 {