# HG changeset patch # User diego # Date 1198720382 0 # Node ID d25e027364d66ecd1d340f65ac8d29d17e45c59f # Parent 033099f22fc25f748d3e6ce2e4275d8215c5e1f8 Check for the presence of llrint(), lrint(), round() and roundf() and provide simple replacements if they are unavailable. patch by Michael Kostylev, mik niipt ru diff -r 033099f22fc2 -r d25e027364d6 internal.h --- a/internal.h Thu Dec 27 01:42:46 2007 +0000 +++ b/internal.h Thu Dec 27 01:53:02 2007 +0000 @@ -270,6 +270,20 @@ }\ } +#ifndef HAVE_LLRINT +static av_always_inline long long llrint(double x) +{ + return rint(x); +} +#endif /* HAVE_LLRINT */ + +#ifndef HAVE_LRINT +static av_always_inline long int lrint(double x) +{ + return rint(x); +} +#endif /* HAVE_LRINT */ + #ifndef HAVE_LRINTF static av_always_inline long int lrintf(float x) { @@ -277,4 +291,18 @@ } #endif /* HAVE_LRINTF */ +#ifndef HAVE_ROUND +static av_always_inline double round(double x) +{ + return (x > 0) ? floor(x + 0.5) : ceil(x - 0.5); +} +#endif /* HAVE_ROUND */ + +#ifndef HAVE_ROUNDF +static av_always_inline float roundf(float x) +{ + return (x > 0) ? floor(x + 0.5) : ceil(x - 0.5); +} +#endif /* HAVE_ROUNDF */ + #endif /* FFMPEG_INTERNAL_H */