]> git.sesse.net Git - ffmpeg/blobdiff - libavutil/libm.h
lavu/libm: add copysign hack
[ffmpeg] / libavutil / libm.h
index 6d8bd685b710abb11e6e3770e5cd10c1cf96c286..37b8e86b5e6e8d3ba473f228244e94d4cbdc2904 100644 (file)
@@ -62,6 +62,15 @@ static av_always_inline float cbrtf(float x)
 }
 #endif
 
+#if !HAVE_COPYSIGN
+static av_always_inline double copysign(double x, double y)
+{
+    uint64_t vx = av_double2int(x);
+    uint64_t vy = av_double2int(y);
+    return av_int2double((vx & UINT64_C(0x7fffffffffffffff)) | (vy & UINT64_C(0x8000000000000000)));
+}
+#endif
+
 #if !HAVE_COSF
 #undef cosf
 #define cosf(x) ((float)cos(x))