Re: sincos opcode (issue205045)


cku...@...
 

On 2010/02/09 01:27:22, ckulla wrote:
using portable sincos instead of calls to sin and cos
Here is the patch to fmath.h:

Index: src/include/fmath.h
===================================================================
--- src/include/fmath.h (revision 1392)
+++ src/include/fmath.h (working copy)
@@ -779,7 +779,29 @@
}


+inline void
+sincos(float x, float* sine, float* cosine)
+{
+#if defined(__GNUC__) && defined(__linux__)
+ __builtin_sincosf(x, sin, cosine);
+#else
+ *sine = std::sin(x);
+ *cosine = std::cos(x);
+#endif
+}

+inline void
+sincos(double x, double* sine, double* cosine)
+{
+#if defined(__GNUC__) && defined(__linux__)
+ __builtin_sincos(x, sin, cosine);
+#else
+ *sine = std::sin(x);
+ *cosine = std::cos(x);
+#endif
+}
+
+
#ifdef OPENIMAGEIO_NAMESPACE
}; // end namespace OPENIMAGEIO_NAMESPACE
using namespace OPENIMAGEIO_NAMESPACE;


http://codereview.appspot.com/205045/show

Join osl-dev@lists.aswf.io to automatically receive all group messages.