aboutsummaryrefslogtreecommitdiff
path: root/fpu/softfloat.c
diff options
context:
space:
mode:
authorRichard Henderson <richard.henderson@linaro.org>2022-04-01 07:22:40 -0600
committerRichard Henderson <richard.henderson@linaro.org>2022-04-26 20:01:55 -0700
commitdee3fcfbb399a0e4ccedbf737b5b0b7f56ecd398 (patch)
tree92142e74bb6099c2fc6eb3a5b97eba67c8ae5c38 /fpu/softfloat.c
parent9343c884445201cfd84955f199b13783fa829372 (diff)
downloadqemu-dee3fcfbb399a0e4ccedbf737b5b0b7f56ecd398.zip
qemu-dee3fcfbb399a0e4ccedbf737b5b0b7f56ecd398.tar.gz
qemu-dee3fcfbb399a0e4ccedbf737b5b0b7f56ecd398.tar.bz2
softfloat: Use FloatRelation for fracN_cmp
Since the caller, partsN_compare, is now exclusively using FloatRelation, it's clearer to use it here too. Signed-off-by: Richard Henderson <richard.henderson@linaro.org> Reviewed-by: Peter Maydell <peter.maydell@linaro.org> Message-Id: <20220401132240.79730-4-richard.henderson@linaro.org>
Diffstat (limited to 'fpu/softfloat.c')
-rw-r--r--fpu/softfloat.c12
1 files changed, 7 insertions, 5 deletions
diff --git a/fpu/softfloat.c b/fpu/softfloat.c
index e7d7ad5..4a871ef 100644
--- a/fpu/softfloat.c
+++ b/fpu/softfloat.c
@@ -957,21 +957,23 @@ static void frac128_allones(FloatParts128 *a)
#define frac_allones(A) FRAC_GENERIC_64_128(allones, A)(A)
-static int frac64_cmp(FloatParts64 *a, FloatParts64 *b)
+static FloatRelation frac64_cmp(FloatParts64 *a, FloatParts64 *b)
{
- return a->frac == b->frac ? 0 : a->frac < b->frac ? -1 : 1;
+ return (a->frac == b->frac ? float_relation_equal
+ : a->frac < b->frac ? float_relation_less
+ : float_relation_greater);
}
-static int frac128_cmp(FloatParts128 *a, FloatParts128 *b)
+static FloatRelation frac128_cmp(FloatParts128 *a, FloatParts128 *b)
{
uint64_t ta = a->frac_hi, tb = b->frac_hi;
if (ta == tb) {
ta = a->frac_lo, tb = b->frac_lo;
if (ta == tb) {
- return 0;
+ return float_relation_equal;
}
}
- return ta < tb ? -1 : 1;
+ return ta < tb ? float_relation_less : float_relation_greater;
}
#define frac_cmp(A, B) FRAC_GENERIC_64_128(cmp, A)(A, B)