aboutsummaryrefslogtreecommitdiff
path: root/softfloat
diff options
context:
space:
mode:
Diffstat (limited to 'softfloat')
-rw-r--r--softfloat/fall_maxmin.c36
1 files changed, 12 insertions, 24 deletions
diff --git a/softfloat/fall_maxmin.c b/softfloat/fall_maxmin.c
index 6405cf1..32a9ade 100644
--- a/softfloat/fall_maxmin.c
+++ b/softfloat/fall_maxmin.c
@@ -45,43 +45,31 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#define COMPARE_MAX(a, b, bits) \
float ## bits ## _t f ## bits ## _max( float ## bits ## _t a, float ## bits ## _t b ) \
{ \
- if (f ## bits ## _isSignalingNaN(a) || \
- f ## bits ## _isSignalingNaN(b)) { \
- union ui ## bits ## _f ## bits ui; \
- ui.ui = defaultNaNF ## bits ## UI; \
- softfloat_raiseFlags( softfloat_flag_invalid ); \
- return ui.f; \
- } else if (isNaNF ## bits ## UI(a.v) && isNaNF ## bits ## UI(b.v)) { \
+ bool greater = f ## bits ## _lt_quiet(b, a) || \
+ (f ## bits ## _eq(b, a) && signF ## bits ## UI(b.v)); \
+ \
+ if (isNaNF ## bits ## UI(a.v) && isNaNF ## bits ## UI(b.v)) { \
union ui ## bits ## _f ## bits ui; \
ui.ui = defaultNaNF ## bits ## UI; \
return ui.f; \
+ } else { \
+ return greater || isNaNF ## bits ## UI((b).v) ? a : b; \
} \
- \
- bool greater = f ## bits ## _lt_quiet(b, a) || \
- (f ## bits ## _eq(b, a) && signF ## bits ## UI(b.v)); \
- \
- return greater || isNaNF ## bits ## UI((b).v) ? a : b; \
}
#define COMPARE_MIN(a, b, bits) \
float ## bits ## _t f ## bits ## _min( float ## bits ## _t a, float ## bits ## _t b ) \
{ \
- if (f ## bits ## _isSignalingNaN(a) || \
- f ## bits ## _isSignalingNaN(b)) { \
- union ui ## bits ## _f ## bits ui; \
- ui.ui = defaultNaNF ## bits ## UI; \
- softfloat_raiseFlags( softfloat_flag_invalid ); \
- return ui.f; \
- } else if (isNaNF ## bits ## UI(a.v) && isNaNF ## bits ## UI(b.v)) { \
+ bool less = f ## bits ## _lt_quiet(a, b) || \
+ (f ## bits ## _eq(a, b) && signF ## bits ## UI(a.v)); \
+ \
+ if (isNaNF ## bits ## UI(a.v) && isNaNF ## bits ## UI(b.v)) { \
union ui ## bits ## _f ## bits ui; \
ui.ui = defaultNaNF ## bits ## UI; \
return ui.f; \
+ } else { \
+ return less || isNaNF ## bits ## UI((b).v) ? a : b; \
} \
- \
- bool greater = f ## bits ## _lt_quiet(a, b) || \
- (f ## bits ## _eq(a, b) && signF ## bits ## UI(a.v)); \
- \
- return greater || isNaNF ## bits ## UI((b).v) ? a : b; \
}
COMPARE_MAX(a, b, 16);