Fixed compilation error
[bochs-mirror.git] / fpu / softfloatx80.h
bloba513058a83fb9720aa432b1336a19888b528c60c
1 /*============================================================================
2 This source file is an extension to the SoftFloat IEC/IEEE Floating-point
3 Arithmetic Package, Release 2b, written for Bochs (x86 achitecture simulator)
4 floating point emulation.
6 THIS SOFTWARE IS DISTRIBUTED AS IS, FOR FREE. Although reasonable effort has
7 been made to avoid it, THIS SOFTWARE MAY CONTAIN FAULTS THAT WILL AT TIMES
8 RESULT IN INCORRECT BEHAVIOR. USE OF THIS SOFTWARE IS RESTRICTED TO PERSONS
9 AND ORGANIZATIONS WHO CAN AND WILL TAKE FULL RESPONSIBILITY FOR ALL LOSSES,
10 COSTS, OR OTHER PROBLEMS THEY INCUR DUE TO THE SOFTWARE, AND WHO FURTHERMORE
11 EFFECTIVELY INDEMNIFY JOHN HAUSER AND THE INTERNATIONAL COMPUTER SCIENCE
12 INSTITUTE (possibly via similar legal warning) AGAINST ALL LOSSES, COSTS, OR
13 OTHER PROBLEMS INCURRED BY THEIR CUSTOMERS AND CLIENTS DUE TO THE SOFTWARE.
15 Derivative works are acceptable, even for commercial purposes, so long as
16 (1) the source code for the derivative work includes prominent notice that
17 the work is derivative, and (2) the source code includes prominent notice with
18 these four paragraphs for those parts of this code that are retained.
19 =============================================================================*/
21 /*============================================================================
22 * Written for Bochs (x86 achitecture simulator) by
23 * Stanislav Shwartsman [sshwarts at sourceforge net]
24 * ==========================================================================*/
26 #ifndef _SOFTFLOATX80_EXTENSIONS_H_
27 #define _SOFTFLOATX80_EXTENSIONS_H_
29 #include "softfloat.h"
30 #include "softfloat-specialize.h"
32 /*----------------------------------------------------------------------------
33 | Software IEC/IEEE integer-to-floating-point conversion routines.
34 *----------------------------------------------------------------------------*/
36 Bit16s floatx80_to_int16(floatx80, float_status_t &status);
37 Bit16s floatx80_to_int16_round_to_zero(floatx80, float_status_t &status);
39 /*----------------------------------------------------------------------------
40 | Software IEC/IEEE extended double-precision operations.
41 *----------------------------------------------------------------------------*/
43 float_class_t floatx80_class(floatx80);
44 floatx80 floatx80_extract(floatx80 &a, float_status_t &status);
45 floatx80 floatx80_scale(floatx80 a, floatx80 b, float_status_t &status);
46 floatx80 floatx80_remainder(floatx80 a, floatx80 b, Bit64u &q, float_status_t &status);
47 floatx80 floatx80_ieee754_remainder(floatx80 a, floatx80 b, Bit64u &q, float_status_t &status);
48 floatx80 f2xm1(floatx80 a, float_status_t &status);
49 floatx80 fyl2x(floatx80 a, floatx80 b, float_status_t &status);
50 floatx80 fyl2xp1(floatx80 a, floatx80 b, float_status_t &status);
51 floatx80 fpatan(floatx80 a, floatx80 b, float_status_t &status);
53 /*----------------------------------------------------------------------------
54 | Software IEC/IEEE extended double-precision trigonometric functions.
55 *----------------------------------------------------------------------------*/
57 int fsincos(floatx80 a, floatx80 *sin_a, floatx80 *cos_a, float_status_t &status);
58 int fsin(floatx80 &a, float_status_t &status);
59 int fcos(floatx80 &a, float_status_t &status);
60 int ftan(floatx80 &a, float_status_t &status);
62 /*----------------------------------------------------------------------------
63 | Software IEC/IEEE extended double-precision compare.
64 *----------------------------------------------------------------------------*/
66 int floatx80_compare(floatx80, floatx80, float_status_t &status);
67 int floatx80_compare_quiet(floatx80, floatx80, float_status_t &status);
69 /*-----------------------------------------------------------------------------
70 | Calculates the absolute value of the extended double-precision floating-point
71 | value `a'. The operation is performed according to the IEC/IEEE Standard
72 | for Binary Floating-Point Arithmetic.
73 *----------------------------------------------------------------------------*/
75 BX_CPP_INLINE floatx80& floatx80_abs(floatx80 &reg)
77 reg.exp &= 0x7FFF;
78 return reg;
81 /*-----------------------------------------------------------------------------
82 | Changes the sign of the extended double-precision floating-point value 'a'.
83 | The operation is performed according to the IEC/IEEE Standard for Binary
84 | Floating-Point Arithmetic.
85 *----------------------------------------------------------------------------*/
87 BX_CPP_INLINE floatx80& floatx80_chs(floatx80 &reg)
89 reg.exp ^= 0x8000;
90 return reg;
93 /*-----------------------------------------------------------------------------
94 | Commonly used extended double-precision floating-point constants.
95 *----------------------------------------------------------------------------*/
97 extern const floatx80 Const_Z;
98 extern const floatx80 Const_1;
100 #endif