annotate DEPENDENCIES/generic/include/boost/numeric/interval/detail/bcc_rounding_control.hpp @ 125:34e428693f5d vext

Vext -> Repoint
author Chris Cannam
date Thu, 14 Jun 2018 11:15:39 +0100
parents 2665513ce2d3
children
rev   line source
Chris@16 1 /* Boost interval/detail/bcc_rounding_control.hpp file
Chris@16 2 *
Chris@16 3 * Copyright 2000 Jens Maurer
Chris@16 4 * Copyright 2002 Hervé Brönnimann, Guillaume Melquiond, Sylvain Pion
Chris@16 5 *
Chris@16 6 * Distributed under the Boost Software License, Version 1.0.
Chris@16 7 * (See accompanying file LICENSE_1_0.txt or
Chris@16 8 * copy at http://www.boost.org/LICENSE_1_0.txt)
Chris@16 9 */
Chris@16 10
Chris@16 11 #ifndef BOOST_NUMERIC_INTERVAL_DETAIL_BCC_ROUNDING_CONTROL_HPP
Chris@16 12 #define BOOST_NUMERIC_INTERVAL_DETAIL_BCC_ROUNDING_CONTROL_HPP
Chris@16 13
Chris@16 14 #ifndef __BORLANDC__
Chris@16 15 # error This header is only intended for Borland C++.
Chris@16 16 #endif
Chris@16 17
Chris@16 18 #ifndef _M_IX86
Chris@16 19 # error This header only works on x86 CPUs.
Chris@16 20 #endif
Chris@16 21
Chris@16 22 #include <float.h> // Borland C++ rounding control
Chris@16 23
Chris@16 24 namespace boost {
Chris@16 25 namespace numeric {
Chris@16 26 namespace interval_lib {
Chris@16 27 namespace detail {
Chris@16 28
Chris@16 29 #ifndef BOOST_NUMERIC_INTERVAL_KEEP_EXCEPTIONS_FOR_BCC
Chris@16 30 extern "C" { unsigned int _RTLENTRY _fm_init(void); }
Chris@16 31
Chris@16 32 struct borland_workaround {
Chris@16 33 borland_workaround() { _fm_init(); }
Chris@16 34 };
Chris@16 35
Chris@16 36 static borland_workaround borland_workaround_exec;
Chris@16 37 #endif // BOOST_NUMERIC_INTERVAL_KEEP_EXCEPTIONS_FOR_BCC
Chris@16 38
Chris@16 39 __inline double rint(double)
Chris@16 40 { __emit__(0xD9); __emit__(0xFC); /* asm FRNDINT */ }
Chris@16 41
Chris@16 42 struct x86_rounding
Chris@16 43 {
Chris@16 44 typedef unsigned int rounding_mode;
Chris@16 45 static void get_rounding_mode(rounding_mode& mode)
Chris@16 46 { mode = _control87(0, 0); }
Chris@16 47 static void set_rounding_mode(const rounding_mode mode)
Chris@16 48 { _control87(mode, 0xffff); }
Chris@16 49 static double to_int(const double& x) { return rint(x); }
Chris@16 50 };
Chris@16 51
Chris@16 52 } // namespace detail
Chris@16 53 } // namespace interval_lib
Chris@16 54 } // namespace numeric
Chris@16 55 } // namespace boost
Chris@16 56
Chris@16 57 #endif /* BOOST_NUMERIC_INTERVAL_DETAIL_BCC_ROUNDING_CONTROL_HPP */