Kaydet (Commit) d1f61b3f authored tarafından Pedro Giffuni's avatar Pedro Giffuni

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. 
üst 908088f6
......@@ -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());
}
};
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment