# HG changeset patch # User michael # Date 1093365235 0 # Node ID 784c38a3ffc2064f56be1dd2cfafceda4717a57e # Parent 3378d0677903eb5479c19ab5394c04e67f5a1031 lrintf emulation improvments diff -r 3378d0677903 -r 784c38a3ffc2 dsputil.h --- 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