You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@openoffice.apache.org by pf...@apache.org on 2013/02/08 17:35:48 UTC

svn commit: r1444115 - /openoffice/trunk/main/vcl/inc/vcl/bitmap.hxx

Author: pfg
Date: Fri Feb  8 16:35:48 2013
New Revision: 1444115

URL: http://svn.apache.org/r1444115
Log:
A miscellaneous use of boost.

Sinc(x) is a simple function used in communications. boost
happens to use it for quaternion math. The implementation is
simple, however it looks fun to re-use the boost function
even if just to say we are using quaternion math somewhere ;).

The performance difference is not likely to be huge but JIC,
set up a specific Boost math policy to limit type promotion
with it's corresponding impact. 

Modified:
    openoffice/trunk/main/vcl/inc/vcl/bitmap.hxx

Modified: openoffice/trunk/main/vcl/inc/vcl/bitmap.hxx
URL: http://svn.apache.org/viewvc/openoffice/trunk/main/vcl/inc/vcl/bitmap.hxx?rev=1444115&r1=1444114&r2=1444115&view=diff
==============================================================================
--- openoffice/trunk/main/vcl/inc/vcl/bitmap.hxx (original)
+++ openoffice/trunk/main/vcl/inc/vcl/bitmap.hxx Fri Feb  8 16:35:48 2013
@@ -30,6 +30,17 @@
 #include <tools/rc.hxx>
 #include <vcl/region.hxx>
 
+#ifdef WNT
+#define _STLP_HAS_NATIVE_FLOAT_ABS
+#endif
+
+#include <boost/math/special_functions/sinc.hpp>
+
+using namespace boost::math::policies;
+typedef policy<
+	promote_double<false>
+> SincPolicy;
+
 // -----------
 // - Defines -
 // -----------
@@ -261,8 +272,7 @@ public:
         }
 
         x *= M_PI;
-
-        return sin(x) / x;
+        return boost::math::sinc_pi(x, SincPolicy());
     }
 };