Mercurial > libavcodec.hg
changeset 2185:784c38a3ffc2 libavcodec
lrintf emulation improvments
author | michael |
---|---|
date | Tue, 24 Aug 2004 16:33:55 +0000 |
parents | 3378d0677903 |
children | be0ad4f3e8ea |
files | dsputil.h |
diffstat | 1 files changed, 11 insertions(+), 2 deletions(-) [+] |
line wrap: on
line diff
--- a/dsputil.h Sun Aug 22 17:16:03 2004 +0000 +++ b/dsputil.h Tue Aug 24 16:33:55 2004 +0000 @@ -583,11 +583,20 @@ /* 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