Move lrintf implementation from libavcodec/dsputil.h to libavutil/common.h
authorDiego Biurrun <diego@biurrun.de>
Mon, 19 Sep 2005 23:26:47 +0000 (23:26 +0000)
committerDiego Biurrun <diego@biurrun.de>
Mon, 19 Sep 2005 23:26:47 +0000 (23:26 +0000)
where it makes more sense.

Originally committed as revision 4599 to svn://svn.ffmpeg.org/ffmpeg/trunk

libavcodec/dsputil.h
libavutil/common.h

index cad3266..c91bac7 100644 (file)
@@ -594,33 +594,4 @@ static int name16(void /*MpegEncContext*/ *s, uint8_t *dst, uint8_t *src, int st
     return score;\
 }
 
-#ifndef HAVE_LRINTF
-/* XXX: add ISOC specific test to avoid specific BSD testing. */
-/* better than nothing implementation. */
-/* btw, rintf() is existing on fbsd too -- alex */
-static always_inline long int lrintf(float x)
-{
-#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 */
-    return (int)(x + (x < 0 ? -0.5 : 0.5));
-#  endif
-#else
-    return (int)(rint(x));
-#endif
-}
-#else
-#ifndef _ISOC9X_SOURCE
-#define _ISOC9X_SOURCE
-#endif
-#include <math.h>
-#endif
-
 #endif
index 8179ece..bbbd4c9 100644 (file)
@@ -543,6 +543,35 @@ tend= read_time();\
     }\
 }
 
+#ifndef HAVE_LRINTF
+/* XXX: add ISOC specific test to avoid specific BSD testing. */
+/* better than nothing implementation. */
+/* btw, rintf() is existing on fbsd too -- alex */
+static always_inline long int lrintf(float x)
+{
+#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 */
+    return (int)(x + (x < 0 ? -0.5 : 0.5));
+#  endif /* ARCH_X86 */
+#else
+    return (int)(rint(x));
+#endif /* CONFIG_WIN32 */
+}
+#else
+#ifndef _ISOC9X_SOURCE
+#define _ISOC9X_SOURCE
+#endif
+#include <math.h>
+#endif /* HAVE_LRINTF */
+
 #endif /* HAVE_AV_CONFIG_H */
 
 #endif /* COMMON_H */