| 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 uint32cxx . . $ uint32# float32cxx . . $ float32#; |
| 41 | typedef structcxx . . $ $anonymous_type_71cc93aa046484fb_0# { |
| 42 | uint32cxx . . $ uint32# highcxx . . $ $anonymous_type_71cc93aa046484fb_0#high., lowcxx . . $ $anonymous_type_71cc93aa046484fb_0#low.; |
| 43 | } float64cxx . . $ float64#; |
| 44 | |
| 45 | /*---------------------------------------------------------------------------- |
| 46 | | Software IEC/IEEE floating-point underflow tininess-detection mode. |
| 47 | *----------------------------------------------------------------------------*/ |
| 48 | extern int8cxx . . $ int8# float_detect_tininesscxx . . $ float_detect_tininess.; |
| 49 | enumcxx . . $ $anonymous_type_71cc93aa046484fb_1# { |
| 50 | float_tininess_after_roundingcxx . . $ float_tininess_after_rounding. = 0, |
| 51 | float_tininess_before_roundingcxx . . $ float_tininess_before_rounding. = 1 |
| 52 | }; |
| 53 | |
| 54 | /*---------------------------------------------------------------------------- |
| 55 | | Software IEC/IEEE floating-point rounding mode. |
| 56 | *----------------------------------------------------------------------------*/ |
| 57 | extern int8cxx . . $ int8# float_rounding_modecxx . . $ float_rounding_mode.; |
| 58 | enumcxx . . $ $anonymous_type_71cc93aa046484fb_2# { |
| 59 | float_round_nearest_evencxx . . $ float_round_nearest_even. = 0, |
| 60 | float_round_to_zerocxx . . $ float_round_to_zero. = 1, |
| 61 | float_round_downcxx . . $ float_round_down. = 2, |
| 62 | float_round_upcxx . . $ float_round_up. = 3 |
| 63 | }; |
| 64 | |
| 65 | /*---------------------------------------------------------------------------- |
| 66 | | Software IEC/IEEE floating-point exception flags. |
| 67 | *----------------------------------------------------------------------------*/ |
| 68 | extern int8cxx . . $ int8# float_exception_flagscxx . . $ float_exception_flags.; |
| 69 | enumcxx . . $ $anonymous_type_71cc93aa046484fb_3# { |
| 70 | float_flag_inexactcxx . . $ float_flag_inexact. = 1, |
| 71 | float_flag_underflowcxx . . $ float_flag_underflow. = 2, |
| 72 | float_flag_overflowcxx . . $ float_flag_overflow. = 4, |
| 73 | float_flag_divbyzerocxx . . $ float_flag_divbyzero. = 8, |
| 74 | float_flag_invalidcxx . . $ 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_raisecxx . . $ float_raise(4af4fd0e2b26c4ac).( int8cxx . . $ int8# ); |
| 82 | |
| 83 | /*---------------------------------------------------------------------------- |
| 84 | | Software IEC/IEEE integer-to-floating-point conversion routines. |
| 85 | *----------------------------------------------------------------------------*/ |
| 86 | float32cxx . . $ float32# int32_to_float32cxx . . $ int32_to_float32(46cc46841198e427).( int32cxx . . $ int32# ); |
| 87 | float64cxx . . $ float64# int32_to_float64cxx . . $ int32_to_float64(7a902f10306e2d58).( int32cxx . . $ int32# ); |
| 88 | |
| 89 | /*---------------------------------------------------------------------------- |
| 90 | | Software IEC/IEEE single-precision conversion routines. |
| 91 | *----------------------------------------------------------------------------*/ |
| 92 | int32cxx . . $ int32# float32_to_int32cxx . . $ float32_to_int32(4c679297bf94b9eb).( float32cxx . . $ float32# ); |
| 93 | int32cxx . . $ int32# float32_to_int32_round_to_zerocxx . . $ float32_to_int32_round_to_zero(4c679297bf94b9eb).( float32cxx . . $ float32# ); |
| 94 | float64cxx . . $ float64# float32_to_float64cxx . . $ float32_to_float64(1dd50e295a7cb77d).( float32cxx . . $ float32# ); |
| 95 | |
| 96 | /*---------------------------------------------------------------------------- |
| 97 | | Software IEC/IEEE single-precision operations. |
| 98 | *----------------------------------------------------------------------------*/ |
| 99 | float32cxx . . $ float32# float32_round_to_intcxx . . $ float32_round_to_int(2141b656ce2cc063).( float32cxx . . $ float32# ); |
| 100 | float32cxx . . $ float32# float32_addcxx . . $ float32_add(83f10ac8959d5577).( float32cxx . . $ float32#, float32cxx . . $ float32# ); |
| 101 | float32cxx . . $ float32# float32_subcxx . . $ float32_sub(83f10ac8959d5577).( float32cxx . . $ float32#, float32cxx . . $ float32# ); |
| 102 | float32cxx . . $ float32# float32_mulcxx . . $ float32_mul(83f10ac8959d5577).( float32cxx . . $ float32#, float32cxx . . $ float32# ); |
| 103 | float32cxx . . $ float32# float32_divcxx . . $ float32_div(83f10ac8959d5577).( float32cxx . . $ float32#, float32cxx . . $ float32# ); |
| 104 | float32cxx . . $ float32# float32_remcxx . . $ float32_rem(83f10ac8959d5577).( float32cxx . . $ float32#, float32cxx . . $ float32# ); |
| 105 | float32cxx . . $ float32# float32_sqrtcxx . . $ float32_sqrt(2141b656ce2cc063).( float32cxx . . $ float32# ); |
| 106 | char float32_eqcxx . . $ float32_eq(56d9946e338c8c19).( float32cxx . . $ float32#, float32cxx . . $ float32# ); |
| 107 | char float32_lecxx . . $ float32_le(56d9946e338c8c19).( float32cxx . . $ float32#, float32cxx . . $ float32# ); |
| 108 | char float32_ltcxx . . $ float32_lt(56d9946e338c8c19).( float32cxx . . $ float32#, float32cxx . . $ float32# ); |
| 109 | char float32_eq_signalingcxx . . $ float32_eq_signaling(56d9946e338c8c19).( float32cxx . . $ float32#, float32cxx . . $ float32# ); |
| 110 | char float32_le_quietcxx . . $ float32_le_quiet(56d9946e338c8c19).( float32cxx . . $ float32#, float32cxx . . $ float32# ); |
| 111 | char float32_lt_quietcxx . . $ float32_lt_quiet(56d9946e338c8c19).( float32cxx . . $ float32#, float32cxx . . $ float32# ); |
| 112 | char float32_is_signaling_nancxx . . $ float32_is_signaling_nan(1cb8f0426fc6e5a2).( float32cxx . . $ float32# ); |
| 113 | |
| 114 | /*---------------------------------------------------------------------------- |
| 115 | | Software IEC/IEEE double-precision conversion routines. |
| 116 | *----------------------------------------------------------------------------*/ |
| 117 | int32cxx . . $ int32# float64_to_int32cxx . . $ float64_to_int32(3eca53c782faf9be).( float64cxx . . $ float64# ); |
| 118 | int32cxx . . $ int32# float64_to_int32_round_to_zerocxx . . $ float64_to_int32_round_to_zero(3eca53c782faf9be).( float64cxx . . $ float64# ); |
| 119 | float32cxx . . $ float32# float64_to_float32cxx . . $ float64_to_float32(86e302ee5fa38a13).( float64cxx . . $ float64# ); |
| 120 | |
| 121 | /*---------------------------------------------------------------------------- |
| 122 | | Software IEC/IEEE double-precision operations. |
| 123 | *----------------------------------------------------------------------------*/ |
| 124 | float64cxx . . $ float64# float64_round_to_intcxx . . $ float64_round_to_int(908d5a9407fe54f3).( float64cxx . . $ float64# ); |
| 125 | float64cxx . . $ float64# float64_addcxx . . $ float64_add(41ee33e49ca60502).( float64cxx . . $ float64#, float64cxx . . $ float64# ); |
| 126 | float64cxx . . $ float64# float64_subcxx . . $ float64_sub(41ee33e49ca60502).( float64cxx . . $ float64#, float64cxx . . $ float64# ); |
| 127 | float64cxx . . $ float64# float64_mulcxx . . $ float64_mul(41ee33e49ca60502).( float64cxx . . $ float64#, float64cxx . . $ float64# ); |
| 128 | float64cxx . . $ float64# float64_divcxx . . $ float64_div(41ee33e49ca60502).( float64cxx . . $ float64#, float64cxx . . $ float64# ); |
| 129 | float64cxx . . $ float64# float64_remcxx . . $ float64_rem(41ee33e49ca60502).( float64cxx . . $ float64#, float64cxx . . $ float64# ); |
| 130 | float64cxx . . $ float64# float64_sqrtcxx . . $ float64_sqrt(908d5a9407fe54f3).( float64cxx . . $ float64# ); |
| 131 | char float64_eqcxx . . $ float64_eq(78e73c68f90d89db).( float64cxx . . $ float64#, float64cxx . . $ float64# ); |
| 132 | char float64_lecxx . . $ float64_le(78e73c68f90d89db).( float64cxx . . $ float64#, float64cxx . . $ float64# ); |
| 133 | char float64_ltcxx . . $ float64_lt(78e73c68f90d89db).( float64cxx . . $ float64#, float64cxx . . $ float64# ); |
| 134 | char float64_eq_signalingcxx . . $ float64_eq_signaling(78e73c68f90d89db).( float64cxx . . $ float64#, float64cxx . . $ float64# ); |
| 135 | char float64_le_quietcxx . . $ float64_le_quiet(78e73c68f90d89db).( float64cxx . . $ float64#, float64cxx . . $ float64# ); |
| 136 | char float64_lt_quietcxx . . $ float64_lt_quiet(78e73c68f90d89db).( float64cxx . . $ float64#, float64cxx . . $ float64# ); |
| 137 | char float64_is_signaling_nancxx . . $ float64_is_signaling_nan(d7d6a2105bf5bfdf).( float64cxx . . $ float64# ); |
| 138 | |
| 139 | #ifdef __cplusplus |
| 140 | }; |
| 141 | #endif |