avutil/libm: Replace macro based fminf() by function
authorMichael Niedermayer <michaelni@gmx.at>
Fri, 6 Jun 2014 14:29:02 +0000 (16:29 +0200)
committerMichael Niedermayer <michaelni@gmx.at>
Fri, 6 Jun 2014 15:18:14 +0000 (17:18 +0200)
This avoids issues when the FFMIN parameter evaluation has side effects

Reviewed-by: Clément Bœsch <u@pkh.me>
Reviewed-by: Derek Buitenhuis <derek.buitenhuis@gmail.com>
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
libavutil/libm.h

index eacb3cc..13e6cfe 100644 (file)
@@ -84,7 +84,10 @@ static av_always_inline float cbrtf(float x)
 
 #if !HAVE_FMINF
 #undef fminf
-#define fminf(x, y) (FFMIN(x,y))
+static av_always_inline av_const float fminf(float x, float y)
+{
+    return FFMIN(x, y);
+}
 #endif
 
 #if !HAVE_ISINF