forked from hercules-390/hyperion
-
Notifications
You must be signed in to change notification settings - Fork 0
/
SoftFloat-types.h
139 lines (127 loc) · 6.52 KB
/
SoftFloat-types.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
/* SoftFloat-types.h (C) John R. Hauser, 1998-2002 */
/* (C) Copyright "Fish" (David B. Trout), 2011 */
/* This module is part of the SoftFloat package. */
/* */
/* Released under "The Q Public License Version 1" */
/* (http://www.hercules-390.org/herclic.html) */
/* as modifications to Hercules. */
/* This module is a SLIGHTLY modified version of John R. Hauser's */
/* 'SoftFloat-types.h', and is largely copyright by him. All I did */
/* (i.e. "Fish", David B. Trout) was change the default underflow */
/* tininess-detection mode, rounding mode and exception flags values */
/* to match values required by z/Architecture and to integrate it */
/* with the Hercules emulator. It is 99.9999% John's work. Refer */
/* to the documents "SoftFloat.txt", "SoftFloat-source.txt", and */
/* "SoftFloat-history.txt" for detailed SoftFloat information. */
/* Fish note: 'FLOATX80' support was removed as we don't need it. */
/* SoftFloat was repackaged to reside in the main source path */
/* to provide FULL CROSS PLATFORM build compatibility. */
/* To make evident the SoftFloat rePackaging standardized names */
/* were used */
/* mileu.h was renamed to SoftFloat-milieu.h and all the sources */
/* were modified accordingly. */
/* no other modifications were made */
/* no reason to clutter the copyright stuff for such a minor change */
/* */
/* the original unmodified SoftFloat package is still distributed */
/* in zipped format here as SoftFloat-2b.zip */
/*----------------------------------------------------------------------------
| One of the macros `BIGENDIAN' or `LITTLEENDIAN' must be defined.
*----------------------------------------------------------------------------*/
#ifndef LITTLEENDIAN
#define LITTLEENDIAN
#endif
/*----------------------------------------------------------------------------
| The macro `BITS64' can be defined to indicate that 64-bit integer types are
| supported by the compiler.
*----------------------------------------------------------------------------*/
#define BITS64
/*----------------------------------------------------------------------------
| Each of the following `typedef's defines the most convenient type that holds
| integers of at least as many bits as specified. For example, `uint8' should
| be the most convenient type that can hold unsigned integers of as many as
| 8 bits. The `flag' type must be able to hold either a 0 or 1. For most
| implementations of C, `flag', `uint8', and `int8' should all be `typedef'ed
| to the same as `int'.
*----------------------------------------------------------------------------*/
typedef char flag;
typedef unsigned char uint8;
typedef signed char int8;
typedef int uint16;
typedef int int16;
typedef unsigned int uint32;
typedef signed int int32;
#ifdef BITS64
typedef unsigned long long int uint64;
typedef signed long long int int64;
#endif
/*----------------------------------------------------------------------------
| Each of the following `typedef's defines a type that holds integers
| of _exactly_ the number of bits specified. For instance, for most
| implementation of C, `bits16' and `sbits16' should be `typedef'ed to
| `unsigned short int' and `signed short int' (or `short int'), respectively.
*----------------------------------------------------------------------------*/
typedef unsigned char bits8;
typedef signed char sbits8;
typedef unsigned short int bits16;
typedef signed short int sbits16;
typedef unsigned int bits32;
typedef signed int sbits32;
#ifdef BITS64
typedef unsigned long long int bits64;
typedef signed long long int sbits64;
#endif
#ifdef BITS64
/*----------------------------------------------------------------------------
| The `LIT64' macro takes as its argument a textual integer literal and
| if necessary ``marks'' the literal as having a 64-bit integer type.
| For example, the GNU C Compiler (`gcc') requires that 64-bit literals be
| appended with the letters `LL' standing for `long long', which is `gcc's
| name for the 64-bit integer type. Some compilers may allow `LIT64' to be
| defined as the identity macro: `#define LIT64( a ) a'.
*----------------------------------------------------------------------------*/
#define LIT64( a ) a##LL
#endif
/*----------------------------------------------------------------------------
| The macro `INLINE' can be used before functions that should be inlined. If
| a compiler does not support explicit inlining, this macro should be defined
| to be `static'.
*----------------------------------------------------------------------------*/
#ifndef INLINE
#define INLINE __inline
#endif
/*----------------------------------------------------------------------------
| The following macro can be used in switch statements to tell the compiler
| that the default branch of the switch statement will never be reached.
*----------------------------------------------------------------------------*/
#ifndef NODEFAULT
#define NODEFAULT default: UNREACHABLE_CODE();
#endif
/*----------------------------------------------------------------------------
| Software IEC/IEEE floating-point underflow tininess-detection mode.
*----------------------------------------------------------------------------*/
enum {
float_tininess_after_rounding = 0,
float_tininess_before_rounding = 1 /* SA22-7832-08, page 9-22 */
};
/*----------------------------------------------------------------------------
| Software IEC/IEEE floating-point rounding mode.
*----------------------------------------------------------------------------*/
enum {
/* These must match the FPC values */
float_round_nearest_even = 0,
float_round_to_zero = 1,
float_round_up = 2,
float_round_down = 3
};
/*----------------------------------------------------------------------------
| Software IEC/IEEE floating-point exception flags.
*----------------------------------------------------------------------------*/
enum {
/* These must match the FPC values */
float_flag_invalid = 0x00800000,
float_flag_divbyzero = 0x00400000,
float_flag_overflow = 0x00200000,
float_flag_underflow = 0x00100000,
float_flag_inexact = 0x00080000
};