comparison dsputil.h @ 2887:28084132c417 libavcodec

Move lrintf implementation from libavcodec/dsputil.h to libavutil/common.h where it makes more sense.
author diego
date Mon, 19 Sep 2005 23:26:47 +0000
parents 930e56f92c57
children ef2149182f1c
comparison
equal deleted inserted replaced
2886:5576a9349ab6 2887:28084132c417
592 score +=name8(s, dst+8 , src+8 , stride, 8);\ 592 score +=name8(s, dst+8 , src+8 , stride, 8);\
593 }\ 593 }\
594 return score;\ 594 return score;\
595 } 595 }
596 596
597 #ifndef HAVE_LRINTF
598 /* XXX: add ISOC specific test to avoid specific BSD testing. */
599 /* better than nothing implementation. */
600 /* btw, rintf() is existing on fbsd too -- alex */
601 static always_inline long int lrintf(float x)
602 {
603 #ifdef CONFIG_WIN32
604 # ifdef ARCH_X86
605 int32_t i;
606 asm volatile(
607 "fistpl %0\n\t"
608 : "=m" (i) : "t" (x) : "st"
609 );
610 return i;
611 # else
612 /* XXX: incorrect, but make it compile */
613 return (int)(x + (x < 0 ? -0.5 : 0.5));
614 # endif
615 #else
616 return (int)(rint(x));
617 #endif 597 #endif
618 }
619 #else
620 #ifndef _ISOC9X_SOURCE
621 #define _ISOC9X_SOURCE
622 #endif
623 #include <math.h>
624 #endif
625
626 #endif