[FFmpeg-devel] [RFC] remove lrintf fallback implementation
Víctor Paesa
wzrlpy
Tue Oct 2 12:50:26 CEST 2007
AUTHOR said Michael Niedermayer
> Hi
>
> On Mon, Oct 01, 2007 at 04:23:46PM +0200, Reimar D?ffinger wrote:
>> Hello,
>> On Mon, Oct 01, 2007 at 03:55:18PM +0200, Diego Biurrun wrote:
>> [...]
>> > I'm not sure which systems still lack lrintf, but we refused to add
>> a fallback implementation of llrint for Cygwin. So IMO the lrintf
>> fallback should go.
>>
>> I don't disagree with removing it, but IIRC just nobody came up with a
>> correct llrint implementation...
>
> IIRC noone tried, there where just people from win32 who had no brain or
> just wanted to troll and then there where the unix people who just didnt
> care about cygwin
>
> maybe a simple (int64_t)rint() would work well enough i dunno and i dont
> care about cygwin
> also theres (int64_t)rintl() as option and theres the one of just not
> using any float&doubles but use integers instead to emulate it
>
> and one could use asm() as well
Do you mean an asm() like this?
Index: libavcodec/i386/mathops.h
===================================================================
--- libavcodec/i386/mathops.h (revision 9441)
+++ libavcodec/i386/mathops.h (working copy)
@@ -42,4 +42,15 @@
asm ("imull %2\n\t" : "=A"(rt) : "a" (ra), "g" (rb));\
rt; })
+#ifndef llrint
+inline long long int llrint (double x)
+{
+ long long int llrintres;
+ asm
+ ("fistpll %0"
+ : "=m" (llrintres) : "t" (x) : "st");
+ return llrintres;
+}
+#endif
+
#endif // AVCODEC_X86_MATHOPS_H
Regards,
V?ctor
More information about the ffmpeg-devel
mailing list