1 /* SPDX-License-Identifier: BSD-3-Clause */
2 
3 /*============================================================================
4 
5 This C header file is part of the SoftFloat IEEE Floating-Point Arithmetic
6 Package, Release 3a, by John R. Hauser.
7 
8 Copyright 2011, 2012, 2013, 2014 The Regents of the University of California.
9 All rights reserved.
10 
11 Redistribution and use in source and binary forms, with or without
12 modification, are permitted provided that the following conditions are met:
13 
14  1. Redistributions of source code must retain the above copyright notice,
15     this list of conditions, and the following disclaimer.
16 
17  2. Redistributions in binary form must reproduce the above copyright notice,
18     this list of conditions, and the following disclaimer in the documentation
19     and/or other materials provided with the distribution.
20 
21  3. Neither the name of the University nor the names of its contributors may
22     be used to endorse or promote products derived from this software without
23     specific prior written permission.
24 
25 THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS "AS IS", AND ANY
26 EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
27 WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE, ARE
28 DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE FOR ANY
29 DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
30 (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
31 LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
32 ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
33 (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
34 SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
35 
36 =============================================================================*/
37 
38 #ifndef softfloat_types_h
39 #define softfloat_types_h 1
40 
41 #include <stdint.h>
42 
43 /*----------------------------------------------------------------------------
44 | Types used to pass 32-bit, 64-bit, and 128-bit floating-point arguments and
45 | results to/from functions.  These types must be exactly 32 bits, 64 bits,
46 | and 128 bits in size, respectively.  Where a platform has "native" support
47 | for IEEE-Standard floating-point formats, the types below may, if desired,
48 | be defined as aliases for the native types (typically `float' and `double',
49 | and possibly `long double').
50 *----------------------------------------------------------------------------*/
51 typedef struct { uint32_t v; } float32_t;
52 typedef struct { uint64_t v; } float64_t;
53 typedef struct { uint64_t v[2]; } float128_t;
54 
55 /*----------------------------------------------------------------------------
56 | The format of an 80-bit extended floating-point number in memory.  This
57 | structure must contain a 16-bit field named `signExp' and a 64-bit field
58 | named `signif'.
59 *----------------------------------------------------------------------------*/
60 #ifdef LITTLEENDIAN
61 struct extFloat80M { uint64_t signif; uint16_t signExp; };
62 #else
63 struct extFloat80M { uint16_t signExp; uint64_t signif; };
64 #endif
65 
66 /*----------------------------------------------------------------------------
67 | The type used to pass 80-bit extended floating-point arguments and
68 | results to/from functions.  This type must have size identical to
69 | `struct extFloat80M'.  Type `extFloat80_t' can be defined as an alias for
70 | `struct extFloat80M'.  Alternatively, if a platform has "native" support
71 | for IEEE-Standard 80-bit extended floating-point, it may be possible,
72 | if desired, to define `extFloat80_t' as an alias for the native type
73 | (presumably either `long double' or a nonstandard compiler-intrinsic type).
74 | In that case, the `signif' and `signExp' fields of `struct extFloat80M'
75 | must align exactly with the locations in memory of the sign, exponent, and
76 | significand of the native type.
77 *----------------------------------------------------------------------------*/
78 typedef struct extFloat80M extFloat80_t;
79 
80 #endif
81 
82