From 183b1c2268529bbb8389d572deb00083c49682dc Mon Sep 17 00:00:00 2001 From: "Ronald S. Bultje" Date: Tue, 26 Jun 2012 15:05:28 +0300 Subject: configure: Check for the math function rint MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Add a fallback implementation if it doesn't exist. Signed-off-by: Martin Storsjö --- libavutil/libm.h | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'libavutil/libm.h') diff --git a/libavutil/libm.h b/libavutil/libm.h index b5821e8267..8305b7c61b 100644 --- a/libavutil/libm.h +++ b/libavutil/libm.h @@ -86,6 +86,13 @@ static av_always_inline av_const int isnan(float x) #define log2f(x) ((float)log2(x)) #endif /* HAVE_LOG2F */ +#if !HAVE_RINT +static inline double rint(double x) +{ + return x >= 0 ? floor(x + 0.5) : ceil(x - 0.5); +} +#endif /* HAVE_RINT */ + #if !HAVE_LRINT static av_always_inline av_const long int lrint(double x) { -- cgit v1.2.3