diff options
author | Michael Kostylev <michael.kostylev@gmail.com> | 2007-12-27 01:53:02 +0000 |
---|---|---|
committer | Diego Biurrun <diego@biurrun.de> | 2007-12-27 01:53:02 +0000 |
commit | a33cab3a9a48cbbb495d2548143751f1dee67213 (patch) | |
tree | 49a8d94893e22f04f0eee8ba84baf7ae3e564f33 /libavutil | |
parent | 52d086084ede74aff217d5854e83bbd3ce863bb5 (diff) | |
download | ffmpeg-a33cab3a9a48cbbb495d2548143751f1dee67213.tar.gz |
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
Originally committed as revision 11326 to svn://svn.ffmpeg.org/ffmpeg/trunk
Diffstat (limited to 'libavutil')
-rw-r--r-- | libavutil/internal.h | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/libavutil/internal.h b/libavutil/internal.h index 93f8a02500..cbb8236071 100644 --- a/libavutil/internal.h +++ b/libavutil/internal.h @@ -270,6 +270,20 @@ if((y)<(x)){\ }\ } +#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 @@ static av_always_inline long int lrintf(float x) } #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 */ |