[Ffmpeg-devel] No llrint() in Cygwin

Víctor Paesa wzrlpy
Tue Sep 26 13:56:28 CEST 2006


Hi,
>
> SVN r6290 brought llrint(), but that function is not defined in Cygwin
> (because it uses newlib for math.h).
>
> I found this LGPL code that defines llrint() as inline for x86:
>
> http://sourceware.org/ml/cygwin/2002-12/msg01146/mathinline.h
>
> Would it be acceptable to copy that llrint() implementation
> into libavcodec/i386/mathops.h ?
>

Maybe this patch will ignite some comments:

===================================================================
--- ffmpeg/libavcodec/i386/mathops.h    (revision 6329)
+++ ffmpeg/libavcodec/i386/mathops.h    (working copy)
@@ -37,3 +37,16 @@
      asm ("imull %2\n\t" : "=A"(rt) : "a" (ra), "g" (rb));\
      rt; })

+#ifndef llrint
+#define __llrint_code \
+    long long int __llrintres;\
+    __asm__ \
+    ("fistpll %0" \
+    : "=m" (__llrintres) : "t" (__x) : "st"); \
+    return __llrintres
+
+__inline long long int llrint (double __x)
+{
+    __llrint_code;
+}
+#endif

The patch (also attached) is just a tab removed version of what appears
in the aforementioned LGPL code.


Regards,
V?ctor Paesa
-------------- next part --------------
A non-text attachment was scrubbed...
Name: ffmpeg.cygwin.llrint.1.diff
Type: text/x-patch
Size: 570 bytes
Desc: not available
URL: <http://lists.mplayerhq.hu/pipermail/ffmpeg-devel/attachments/20060926/bbaace61/attachment.bin>



More information about the ffmpeg-devel mailing list