diff options
author | Michael Niedermayer <michaelni@gmx.at> | 2004-08-24 16:33:55 +0000 |
---|---|---|
committer | Michael Niedermayer <michaelni@gmx.at> | 2004-08-24 16:33:55 +0000 |
commit | 91d6655aa7a1f58838b5946cac960b49c6081132 (patch) | |
tree | 7b94808323ac03e9612038aa721f6410336226dd /libavcodec | |
parent | f2fe8752ab8b695863656f31396bcedeaf6f7bbf (diff) | |
download | ffmpeg-91d6655aa7a1f58838b5946cac960b49c6081132.tar.gz |
lrintf emulation improvments
Originally committed as revision 3412 to svn://svn.ffmpeg.org/ffmpeg/trunk
Diffstat (limited to 'libavcodec')
-rw-r--r-- | libavcodec/dsputil.h | 13 |
1 files changed, 11 insertions, 2 deletions
diff --git a/libavcodec/dsputil.h b/libavcodec/dsputil.h index 494c6f61c5..5aaa94c3ce 100644 --- a/libavcodec/dsputil.h +++ b/libavcodec/dsputil.h @@ -583,11 +583,20 @@ static int name16(void /*MpegEncContext*/ *s, uint8_t *dst, uint8_t *src, int st /* XXX: add ISOC specific test to avoid specific BSD testing. */ /* better than nothing implementation. */ /* btw, rintf() is existing on fbsd too -- alex */ -static inline long int lrintf(float x) +static always_inline long int lrintf(float x) { #ifdef CONFIG_WIN32 +# ifdef ARCH_X86 + int32_t i; + asm volatile( + "fistpl %0\n\t" + : "=m" (i) : "t" (x) : "st" + ); + return i; +# else /* XXX: incorrect, but make it compile */ - return (int)(x); + return (int)(x + (x < 0 ? -0.5 : 0.5)); +# endif #else return (int)(rint(x)); #endif |