Warning, file /include/boost/numeric/interval/detail/x86gcc_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 #ifndef BOOST_NUMERIC_INTERVAL_DETAIL_X86GCC_ROUNDING_CONTROL_HPP
0012 #define BOOST_NUMERIC_INTERVAL_DETAIL_X86GCC_ROUNDING_CONTROL_HPP
0013
0014 #if !defined(__GNUC__) && !(defined(__BORLANDC__) && defined(__clang__))
0015 # error This header only works with GNU CC.
0016 #endif
0017
0018 #if !defined(__i386__) && !defined(__x86_64__)
0019 # error This header only works on x86 CPUs.
0020 #endif
0021
0022 namespace boost {
0023 namespace numeric {
0024 namespace interval_lib {
0025 namespace detail {
0026
0027 struct x86_rounding
0028 {
0029 typedef unsigned short rounding_mode;
0030
0031 static void set_rounding_mode(const rounding_mode& mode)
0032 { __asm__ __volatile__ ("fldcw %0" : : "m"(mode)); }
0033
0034 static void get_rounding_mode(rounding_mode& mode)
0035 { __asm__ __volatile__ ("fnstcw %0" : "=m"(mode)); }
0036
0037 template<class T>
0038 static T to_int(T r)
0039 {
0040 T r_;
0041 __asm__ ("frndint" : "=&t"(r_) : "0"(r));
0042 return r_;
0043 }
0044 };
0045
0046 }
0047 }
0048 }
0049 }
0050
0051 #endif