Revision 7df65455 libavutil/common.h

View differences:

libavutil/common.h
543 543
    }\
544 544
}
545 545

  
546
#ifndef HAVE_LRINTF
547
/* XXX: add ISOC specific test to avoid specific BSD testing. */
548
/* better than nothing implementation. */
549
/* btw, rintf() is existing on fbsd too -- alex */
550
static always_inline long int lrintf(float x)
551
{
552
#ifdef CONFIG_WIN32
553
#  ifdef ARCH_X86
554
    int32_t i;
555
    asm volatile(
556
        "fistpl %0\n\t"
557
        : "=m" (i) : "t" (x) : "st"
558
    );
559
    return i;
560
#  else
561
    /* XXX: incorrect, but make it compile */
562
    return (int)(x + (x < 0 ? -0.5 : 0.5));
563
#  endif /* ARCH_X86 */
564
#else
565
    return (int)(rint(x));
566
#endif /* CONFIG_WIN32 */
567
}
568
#else
569
#ifndef _ISOC9X_SOURCE
570
#define _ISOC9X_SOURCE
571
#endif
572
#include <math.h>
573
#endif /* HAVE_LRINTF */
574

  
546 575
#endif /* HAVE_AV_CONFIG_H */
547 576

  
548 577
#endif /* COMMON_H */

Also available in: Unified diff