2012-02-03 06:08:17 -05:00
|
|
|
|
2012-05-24 17:21:18 -04:00
|
|
|
/*============================================================================
|
2012-02-03 06:08:17 -05:00
|
|
|
|
2012-05-24 17:21:18 -04:00
|
|
|
This C header file is part of the SoftFloat IEC/IEEE Floating-point Arithmetic
|
|
|
|
Package, Release 2b.
|
2012-02-03 06:08:17 -05:00
|
|
|
|
|
|
|
Written by John R. Hauser. This work was made possible in part by the
|
|
|
|
International Computer Science Institute, located at Suite 600, 1947 Center
|
|
|
|
Street, Berkeley, California 94704. Funding was partially provided by the
|
|
|
|
National Science Foundation under grant MIP-9311980. The original version
|
|
|
|
of this code was written as part of a project to build a fixed-point vector
|
|
|
|
processor in collaboration with the University of California at Berkeley,
|
|
|
|
overseen by Profs. Nelson Morgan and John Wawrzynek. More information
|
2012-05-24 17:21:18 -04:00
|
|
|
is available through the Web page `http://www.cs.berkeley.edu/~jhauser/
|
|
|
|
arithmetic/SoftFloat.html'.
|
2012-02-03 06:08:17 -05:00
|
|
|
|
2012-05-24 17:21:18 -04:00
|
|
|
THIS SOFTWARE IS DISTRIBUTED AS IS, FOR FREE. Although reasonable effort has
|
|
|
|
been made to avoid it, THIS SOFTWARE MAY CONTAIN FAULTS THAT WILL AT TIMES
|
|
|
|
RESULT IN INCORRECT BEHAVIOR. USE OF THIS SOFTWARE IS RESTRICTED TO PERSONS
|
|
|
|
AND ORGANIZATIONS WHO CAN AND WILL TAKE FULL RESPONSIBILITY FOR ALL LOSSES,
|
|
|
|
COSTS, OR OTHER PROBLEMS THEY INCUR DUE TO THE SOFTWARE, AND WHO FURTHERMORE
|
|
|
|
EFFECTIVELY INDEMNIFY JOHN HAUSER AND THE INTERNATIONAL COMPUTER SCIENCE
|
|
|
|
INSTITUTE (possibly via similar legal warning) AGAINST ALL LOSSES, COSTS, OR
|
|
|
|
OTHER PROBLEMS INCURRED BY THEIR CUSTOMERS AND CLIENTS DUE TO THE SOFTWARE.
|
2012-02-03 06:08:17 -05:00
|
|
|
|
|
|
|
Derivative works are acceptable, even for commercial purposes, so long as
|
2012-05-24 17:21:18 -04:00
|
|
|
(1) the source code for the derivative work includes prominent notice that
|
|
|
|
the work is derivative, and (2) the source code includes prominent notice with
|
|
|
|
these four paragraphs for those parts of this code that are retained.
|
|
|
|
|
|
|
|
=============================================================================*/
|
|
|
|
|
|
|
|
/*----------------------------------------------------------------------------
|
|
|
|
| Include common integer types and flags.
|
|
|
|
*----------------------------------------------------------------------------*/
|
|
|
|
|
|
|
|
/*----------------------------------------------------------------------------
|
|
|
|
| One of the macros `BIGENDIAN' or `LITTLEENDIAN' must be defined.
|
|
|
|
*----------------------------------------------------------------------------*/
|
2012-02-03 06:08:17 -05:00
|
|
|
#define BIGENDIAN
|
|
|
|
|
2012-05-24 17:21:18 -04:00
|
|
|
/*----------------------------------------------------------------------------
|
|
|
|
| The macro `BITS64' can be defined to indicate that 64-bit integer types are
|
|
|
|
| supported by the compiler.
|
|
|
|
*----------------------------------------------------------------------------*/
|
2012-02-03 06:08:17 -05:00
|
|
|
//#define BITS64
|
|
|
|
|
2012-05-24 17:21:18 -04:00
|
|
|
/*----------------------------------------------------------------------------
|
|
|
|
| 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'.
|
|
|
|
*----------------------------------------------------------------------------*/
|
2012-02-03 06:08:17 -05:00
|
|
|
typedef int flag;
|
|
|
|
typedef int uint8;
|
|
|
|
typedef int int8;
|
|
|
|
typedef int uint16;
|
|
|
|
typedef int int16;
|
|
|
|
typedef unsigned int uint32;
|
|
|
|
typedef signed int int32;
|
|
|
|
#ifdef BITS64
|
2012-05-24 17:21:18 -04:00
|
|
|
typedef unsigned long long int uint64;
|
|
|
|
typedef signed long long int int64;
|
2012-02-03 06:08:17 -05:00
|
|
|
#endif
|
|
|
|
|
2012-05-24 17:21:18 -04:00
|
|
|
/*----------------------------------------------------------------------------
|
|
|
|
| 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.
|
|
|
|
*----------------------------------------------------------------------------*/
|
2012-02-03 06:08:17 -05:00
|
|
|
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
|
2012-05-24 17:21:18 -04:00
|
|
|
typedef unsigned long long int bits64;
|
|
|
|
typedef signed long long int sbits64;
|
2012-02-03 06:08:17 -05:00
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifdef BITS64
|
2012-05-24 17:21:18 -04:00
|
|
|
/*----------------------------------------------------------------------------
|
|
|
|
| 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'.
|
|
|
|
*----------------------------------------------------------------------------*/
|
2012-02-03 06:08:17 -05:00
|
|
|
#define LIT64( a ) a##LL
|
|
|
|
#endif
|
|
|
|
|
2012-05-24 17:21:18 -04:00
|
|
|
/*----------------------------------------------------------------------------
|
|
|
|
| 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'.
|
|
|
|
*----------------------------------------------------------------------------*/
|
2012-02-03 06:08:17 -05:00
|
|
|
#define INLINE extern inline
|
|
|
|
|
2012-05-24 17:21:18 -04:00
|
|
|
|
|
|
|
/*----------------------------------------------------------------------------
|
|
|
|
| Symbolic Boolean literals.
|
|
|
|
*----------------------------------------------------------------------------*/
|
2012-02-03 06:08:17 -05:00
|
|
|
enum {
|
|
|
|
FALSE = 0,
|
|
|
|
TRUE = 1
|
|
|
|
};
|
|
|
|
|