lrintf emulation improvments
Originally committed as revision 3412 to svn://svn.ffmpeg.org/ffmpeg/trunk
This commit is contained in:
parent
f2fe8752ab
commit
91d6655aa7
@ -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
|
||||||
|
Loading…
Reference in New Issue
Block a user