1 /* Boost interval/detail/x86gcc_rounding_control.hpp file
3 * Copyright 2000 Jens Maurer
4 * Copyright 2002 Hervé Brönnimann, Guillaume Melquiond, Sylvain Pion
6 * Distributed under the Boost Software License, Version 1.0.
7 * (See accompanying file LICENSE_1_0.txt or
8 * copy at http://www.boost.org/LICENSE_1_0.txt)
11 #ifndef BOOST_NUMERIC_INTERVAL_DETAIL_X86GCC_ROUNDING_CONTROL_HPP
12 #define BOOST_NUMERIC_INTERVAL_DETAIL_X86GCC_ROUNDING_CONTROL_HPP
15 # error This header only works with GNU CC.
19 # error This header only works on x86 CPUs.
24 namespace interval_lib {
29 typedef unsigned short rounding_mode;
31 static void set_rounding_mode(const rounding_mode& mode)
32 { __asm__ __volatile__ ("fldcw %0" : : "m"(mode)); }
34 static void get_rounding_mode(rounding_mode& mode)
35 { __asm__ __volatile__ ("fnstcw %0" : "=m"(mode)); }
41 __asm__ ("frndint" : "=&t"(r_) : "0"(r));
47 } // namespace interval_lib
48 } // namespace numeric
51 #endif /* BOOST_NUMERIC_INTERVAL_DETAIL_X86GCC_ROUNDING_CONTROL_HPP */