Debian Codegraph @

mednafen/hw_cpu/v810/fpu-new/softfloat.h

raw symbols SCIP
1
2 /*============================================================================
3
4 This C header file is part of the SoftFloat IEC/IEEE Floating-point Arithmetic
5 Package, Release 2b.
6
7 Written by John R. Hauser. This work was made possible in part by the
8 International Computer Science Institute, located at Suite 600, 1947 Center
9 Street, Berkeley, California 94704. Funding was partially provided by the
10 National Science Foundation under grant MIP-9311980. The original version
11 of this code was written as part of a project to build a fixed-point vector
12 processor in collaboration with the University of California at Berkeley,
13 overseen by Profs. Nelson Morgan and John Wawrzynek. More information
14 is available through the Web page `http://www.cs.berkeley.edu/~jhauser/
15 arithmetic/SoftFloat.html'.
16
17 THIS SOFTWARE IS DISTRIBUTED AS IS, FOR FREE. Although reasonable effort has
18 been made to avoid it, THIS SOFTWARE MAY CONTAIN FAULTS THAT WILL AT TIMES
19 RESULT IN INCORRECT BEHAVIOR. USE OF THIS SOFTWARE IS RESTRICTED TO PERSONS
20 AND ORGANIZATIONS WHO CAN AND WILL TAKE FULL RESPONSIBILITY FOR ALL LOSSES,
21 COSTS, OR OTHER PROBLEMS THEY INCUR DUE TO THE SOFTWARE, AND WHO FURTHERMORE
22 EFFECTIVELY INDEMNIFY JOHN HAUSER AND THE INTERNATIONAL COMPUTER SCIENCE
23 INSTITUTE (possibly via similar legal warning) AGAINST ALL LOSSES, COSTS, OR
24 OTHER PROBLEMS INCURRED BY THEIR CUSTOMERS AND CLIENTS DUE TO THE SOFTWARE.
25
26 Derivative works are acceptable, even for commercial purposes, so long as
27 (1) the source code for the derivative work includes prominent notice that
28 the work is derivative, and (2) the source code includes prominent notice with
29 these four paragraphs for those parts of this code that are retained.
30
31 =============================================================================*/
32
33 #ifdef __cplusplus
34 extern "C" {
35 #endif
36
37 /*----------------------------------------------------------------------------
38 | Software IEC/IEEE floating-point types.
39 *----------------------------------------------------------------------------*/
40 typedef uint32 float32;
41 typedef struct {
42 uint32 high, low;
43 } float64;
44
45 /*----------------------------------------------------------------------------
46 | Software IEC/IEEE floating-point underflow tininess-detection mode.
47 *----------------------------------------------------------------------------*/
48 extern int8 float_detect_tininess;
49 enum {
50 float_tininess_after_rounding = 0,
51 float_tininess_before_rounding = 1
52 };
53
54 /*----------------------------------------------------------------------------
55 | Software IEC/IEEE floating-point rounding mode.
56 *----------------------------------------------------------------------------*/
57 extern int8 float_rounding_mode;
58 enum {
59 float_round_nearest_even = 0,
60 float_round_to_zero = 1,
61 float_round_down = 2,
62 float_round_up = 3
63 };
64
65 /*----------------------------------------------------------------------------
66 | Software IEC/IEEE floating-point exception flags.
67 *----------------------------------------------------------------------------*/
68 extern int8 float_exception_flags;
69 enum {
70 float_flag_inexact = 1,
71 float_flag_underflow = 2,
72 float_flag_overflow = 4,
73 float_flag_divbyzero = 8,
74 float_flag_invalid = 16
75 };
76
77 /*----------------------------------------------------------------------------
78 | Routine to raise any or all of the software IEC/IEEE floating-point
79 | exception flags.
80 *----------------------------------------------------------------------------*/
81 void float_raise( int8 );
82
83 /*----------------------------------------------------------------------------
84 | Software IEC/IEEE integer-to-floating-point conversion routines.
85 *----------------------------------------------------------------------------*/
86 float32 int32_to_float32( int32 );
87 float64 int32_to_float64( int32 );
88
89 /*----------------------------------------------------------------------------
90 | Software IEC/IEEE single-precision conversion routines.
91 *----------------------------------------------------------------------------*/
92 int32 float32_to_int32( float32 );
93 int32 float32_to_int32_round_to_zero( float32 );
94 float64 float32_to_float64( float32 );
95
96 /*----------------------------------------------------------------------------
97 | Software IEC/IEEE single-precision operations.
98 *----------------------------------------------------------------------------*/
99 float32 float32_round_to_int( float32 );
100 float32 float32_add( float32, float32 );
101 float32 float32_sub( float32, float32 );
102 float32 float32_mul( float32, float32 );
103 float32 float32_div( float32, float32 );
104 float32 float32_rem( float32, float32 );
105 float32 float32_sqrt( float32 );
106 char float32_eq( float32, float32 );
107 char float32_le( float32, float32 );
108 char float32_lt( float32, float32 );
109 char float32_eq_signaling( float32, float32 );
110 char float32_le_quiet( float32, float32 );
111 char float32_lt_quiet( float32, float32 );
112 char float32_is_signaling_nan( float32 );
113
114 /*----------------------------------------------------------------------------
115 | Software IEC/IEEE double-precision conversion routines.
116 *----------------------------------------------------------------------------*/
117 int32 float64_to_int32( float64 );
118 int32 float64_to_int32_round_to_zero( float64 );
119 float32 float64_to_float32( float64 );
120
121 /*----------------------------------------------------------------------------
122 | Software IEC/IEEE double-precision operations.
123 *----------------------------------------------------------------------------*/
124 float64 float64_round_to_int( float64 );
125 float64 float64_add( float64, float64 );
126 float64 float64_sub( float64, float64 );
127 float64 float64_mul( float64, float64 );
128 float64 float64_div( float64, float64 );
129 float64 float64_rem( float64, float64 );
130 float64 float64_sqrt( float64 );
131 char float64_eq( float64, float64 );
132 char float64_le( float64, float64 );
133 char float64_lt( float64, float64 );
134 char float64_eq_signaling( float64, float64 );
135 char float64_le_quiet( float64, float64 );
136 char float64_lt_quiet( float64, float64 );
137 char float64_is_signaling_nan( float64 );
138
139 #ifdef __cplusplus
140 };
141 #endif