Commit 247f2531 authored by michael's avatar michael

lrintf emulation improvments


git-svn-id: file:///var/local/repositories/ffmpeg/trunk@3412 9553f0bf-9b14-0410-a0b8-cfaf0461ba5b
parent c5b0d2ad
...@@ -583,11 +583,20 @@ static int name16(void /*MpegEncContext*/ *s, uint8_t *dst, uint8_t *src, int st ...@@ -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. */ /* XXX: add ISOC specific test to avoid specific BSD testing. */
/* better than nothing implementation. */ /* better than nothing implementation. */
/* btw, rintf() is existing on fbsd too -- alex */ /* 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 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 */ /* XXX: incorrect, but make it compile */
return (int)(x); return (int)(x + (x < 0 ? -0.5 : 0.5));
# endif
#else #else
return (int)(rint(x)); return (int)(rint(x));
#endif #endif
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment