From 7b04b8a0578a29f6403a8da74a94d1015c51c7ab Mon Sep 17 00:00:00 2001 From: Michael Kostylev Date: Sun, 11 Jan 2009 22:10:04 +0000 Subject: Add truncf() replacement function. Patch by Michael Kostylev Originally committed as revision 16555 to svn://svn.ffmpeg.org/ffmpeg/trunk --- configure | 3 ++- libavutil/internal.h | 7 +++++++ 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/configure b/configure index 37af6c4bca..f07e922839 100755 --- a/configure +++ b/configure @@ -886,6 +886,7 @@ HAVE_LIST=" sys_videoio_h termios_h threads + truncf winsock2_h yasm " @@ -1875,7 +1876,7 @@ done check_lib math.h sin -lm # test for C99 functions in math.h -for func in llrint lrint lrintf round roundf; do +for func in llrint lrint lrintf round roundf truncf; do check_exec < int main(void) { return ($func(3.999f) > 0)?0:1; } diff --git a/libavutil/internal.h b/libavutil/internal.h index bbf4407139..957566026d 100644 --- a/libavutil/internal.h +++ b/libavutil/internal.h @@ -294,4 +294,11 @@ static av_always_inline av_const float roundf(float x) } #endif /* HAVE_ROUNDF */ +#ifndef HAVE_TRUNCF +static av_always_inline av_const float truncf(float x) +{ + return (x > 0) ? floor(x) : ceil(x); +} +#endif /* HAVE_TRUNCF */ + #endif /* AVUTIL_INTERNAL_H */ -- cgit v1.2.3