Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit ad8fb553 authored by Ralf Baechle's avatar Ralf Baechle
Browse files

MIPS: math-emu: Replace DP_MBITS with DP_FBITS and SP_MBITS with SP_FBITS.



Both were defined as 23 rsp. 52 though the mentissa is actually a bit more
than the fraction.

Signed-off-by: default avatarRalf Baechle <ralf@linux-mips.org>
parent f5410d19
Loading
Loading
Loading
Loading
+2 −2
Original line number Diff line number Diff line
@@ -153,7 +153,7 @@ union ieee754dp ieee754dp_add(union ieee754dp x, union ieee754dp y)
		xe = xe;
		xs = xs;

		if (xm >> (DP_MBITS + 1 + 3)) { /* carry out */
		if (xm >> (DP_FBITS + 1 + 3)) { /* carry out */
			xm = XDPSRS1(xm);
			xe++;
		}
@@ -172,7 +172,7 @@ union ieee754dp ieee754dp_add(union ieee754dp x, union ieee754dp y)
					      IEEE754_RD);

		/* normalize to rounding precision */
		while ((xm >> (DP_MBITS + 3)) == 0) {
		while ((xm >> (DP_FBITS + 3)) == 0) {
			xm <<= 1;
			xe--;
		}
+2 −2
Original line number Diff line number Diff line
@@ -129,7 +129,7 @@ union ieee754dp ieee754dp_div(union ieee754dp x, union ieee754dp y)
		int re = xe - ye;
		u64 bm;

		for (bm = DP_MBIT(DP_MBITS + 2); bm; bm >>= 1) {
		for (bm = DP_MBIT(DP_FBITS + 2); bm; bm >>= 1) {
			if (xm >= ym) {
				xm -= ym;
				rm |= bm;
@@ -146,7 +146,7 @@ union ieee754dp ieee754dp_div(union ieee754dp x, union ieee754dp y)

		/* normalise rm to rounding precision ?
		 */
		while ((rm >> (DP_MBITS + 3)) == 0) {
		while ((rm >> (DP_FBITS + 3)) == 0) {
			rm <<= 1;
			re--;
		}
+2 −2
Original line number Diff line number Diff line
@@ -52,8 +52,8 @@ union ieee754dp ieee754dp_fint(int x)
	}

	/* normalize - result can never be inexact or overflow */
	xe = DP_MBITS;
	while ((xm >> DP_MBITS) == 0) {
	xe = DP_FBITS;
	while ((xm >> DP_FBITS) == 0) {
		xm <<= 1;
		xe--;
	}
+4 −4
Original line number Diff line number Diff line
@@ -52,15 +52,15 @@ union ieee754dp ieee754dp_flong(s64 x)
	}

	/* normalize */
	xe = DP_MBITS + 3;
	if (xm >> (DP_MBITS + 1 + 3)) {
	xe = DP_FBITS + 3;
	if (xm >> (DP_FBITS + 1 + 3)) {
		/* shunt out overflow bits */
		while (xm >> (DP_MBITS + 1 + 3)) {
		while (xm >> (DP_FBITS + 1 + 3)) {
			XDPSRSX1();
		}
	} else {
		/* normalize in grs extended double precision */
		while ((xm >> (DP_MBITS + 3)) == 0) {
		while ((xm >> (DP_FBITS + 3)) == 0) {
			xm <<= 1;
			xe--;
		}
+4 −4
Original line number Diff line number Diff line
@@ -44,8 +44,8 @@ union ieee754dp ieee754dp_fsp(union ieee754sp x)
		return ieee754dp_nanxcpt(builddp(xs,
						 DP_EMAX + 1 + DP_EBIAS,
						 ((u64) xm
						  << (DP_MBITS -
						      SP_MBITS))), "fsp",
						  << (DP_FBITS -
						      SP_FBITS))), "fsp",
					 x);
	case IEEE754_CLASS_INF:
		return ieee754dp_inf(xs);
@@ -53,7 +53,7 @@ union ieee754dp ieee754dp_fsp(union ieee754sp x)
		return ieee754dp_zero(xs);
	case IEEE754_CLASS_DNORM:
		/* normalize */
		while ((xm >> SP_MBITS) == 0) {
		while ((xm >> SP_FBITS) == 0) {
			xm <<= 1;
			xe--;
		}
@@ -69,5 +69,5 @@ union ieee754dp ieee754dp_fsp(union ieee754sp x)
	xm &= ~SP_HIDDEN_BIT;

	return builddp(xs, xe + DP_EBIAS,
		       (u64) xm << (DP_MBITS - SP_MBITS));
		       (u64) xm << (DP_FBITS - SP_FBITS));
}
Loading