Warning, file /include/boost/numeric/interval/ext/x86_fast_rounding_control.hpp was not indexed
or was modified since last indexation (in which case cross-reference links may be missing, inaccurate or erroneous).
0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014
0015
0016
0017 #ifndef BOOST_NUMERIC_INTERVAL_EXT_X86_FAST_ROUNDING_CONTROL_HPP
0018 #define BOOST_NUMERIC_INTERVAL_EXT_X86_FAST_ROUNDING_CONTROL_HPP
0019
0020 namespace boost {
0021 namespace numeric {
0022 namespace interval_lib {
0023
0024 namespace detail {
0025
0026
0027 static const fpu_rounding_modes rnd_mode_f = { 0x107f, 0x147f, 0x187f, 0x1c7f };
0028 static const fpu_rounding_modes rnd_mode_d = { 0x127f, 0x167f, 0x1a7f, 0x1e7f };
0029 static const fpu_rounding_modes rnd_mode_l = { 0x137f, 0x177f, 0x1b7f, 0x1f7f };
0030
0031 }
0032
0033 template<class T>
0034 struct x86_fast_rounding_control;
0035
0036 template<>
0037 struct x86_fast_rounding_control<float>: detail::x86_rounding
0038 {
0039 static void to_nearest() { set_rounding_mode(detail::rnd_mode_f.to_nearest); }
0040 static void downward() { set_rounding_mode(detail::rnd_mode_f.downward); }
0041 static void upward() { set_rounding_mode(detail::rnd_mode_f.upward); }
0042 static void toward_zero() { set_rounding_mode(detail::rnd_mode_f.toward_zero); }
0043 static const float& force_rounding(const float& r) { return r; }
0044 };
0045
0046 template<>
0047 struct x86_fast_rounding_control<double>: detail::x86_rounding
0048 {
0049 static void to_nearest() { set_rounding_mode(detail::rnd_mode_d.to_nearest); }
0050 static void downward() { set_rounding_mode(detail::rnd_mode_d.downward); }
0051 static void upward() { set_rounding_mode(detail::rnd_mode_d.upward); }
0052 static void toward_zero() { set_rounding_mode(detail::rnd_mode_d.toward_zero); }
0053 static const double& force_rounding(const double& r) { return r; }
0054 };
0055
0056 template<>
0057 struct x86_fast_rounding_control<long double>: detail::x86_rounding
0058 {
0059 static void to_nearest() { set_rounding_mode(detail::rnd_mode_l.to_nearest); }
0060 static void downward() { set_rounding_mode(detail::rnd_mode_l.downward); }
0061 static void upward() { set_rounding_mode(detail::rnd_mode_l.upward); }
0062 static void toward_zero() { set_rounding_mode(detail::rnd_mode_l.toward_zero); }
0063 static const long double& force_rounding(const long double& r) { return r; }
0064 };
0065
0066 }
0067 }
0068 }
0069
0070 #endif