MIPS: math-emu: Eleminate duplicate definitions of identical macros.
[cascardo/linux.git] / arch / mips / math-emu / sp_tlong.c
index d0ca6e2..e979aa7 100644 (file)
 
 
 #include "ieee754sp.h"
+#include "ieee754dp.h"
 
-s64 ieee754sp_tlong(ieee754sp x)
+s64 ieee754sp_tlong(union ieee754sp x)
 {
        COMPXDP;                /* <-- need 64-bit mantissa tmp */
 
-       CLEARCX;
+       ieee754_clearcx();
 
        EXPLODEXSP;
        FLUSHXSP;
@@ -39,7 +40,7 @@ s64 ieee754sp_tlong(ieee754sp x)
        case IEEE754_CLASS_SNAN:
        case IEEE754_CLASS_QNAN:
        case IEEE754_CLASS_INF:
-               SETCX(IEEE754_INVALID_OPERATION);
+               ieee754_setcx(IEEE754_INVALID_OPERATION);
                return ieee754di_xcpt(ieee754di_indef(), "sp_tlong", x);
        case IEEE754_CLASS_ZERO:
                return 0;
@@ -53,13 +54,13 @@ s64 ieee754sp_tlong(ieee754sp x)
                        return -0x8000000000000000LL;
                /* Set invalid. We will only use overflow for floating
                   point overflow */
-               SETCX(IEEE754_INVALID_OPERATION);
+               ieee754_setcx(IEEE754_INVALID_OPERATION);
                return ieee754di_xcpt(ieee754di_indef(), "sp_tlong", x);
        }
        /* oh gawd */
-       if (xe > SP_MBITS) {
-               xm <<= xe - SP_MBITS;
-       } else if (xe < SP_MBITS) {
+       if (xe > SP_FBITS) {
+               xm <<= xe - SP_FBITS;
+       } else if (xe < SP_FBITS) {
                u32 residue;
                int round;
                int sticky;
@@ -71,10 +72,10 @@ s64 ieee754sp_tlong(ieee754sp x)
                        sticky = residue != 0;
                        xm = 0;
                } else {
-                       residue = xm << (32 - SP_MBITS + xe);
+                       residue = xm << (32 - SP_FBITS + xe);
                        round = (residue >> 31) != 0;
                        sticky = (residue << 1) != 0;
-                       xm >>= SP_MBITS - xe;
+                       xm >>= SP_FBITS - xe;
                }
                odd = (xm & 0x1) != 0x0;
                switch (ieee754_csr.rm) {
@@ -95,11 +96,11 @@ s64 ieee754sp_tlong(ieee754sp x)
                }
                if ((xm >> 63) != 0) {
                        /* This can happen after rounding */
-                       SETCX(IEEE754_INVALID_OPERATION);
+                       ieee754_setcx(IEEE754_INVALID_OPERATION);
                        return ieee754di_xcpt(ieee754di_indef(), "sp_tlong", x);
                }
                if (round || sticky)
-                       SETCX(IEEE754_INEXACT);
+                       ieee754_setcx(IEEE754_INEXACT);
        }
        if (xs)
                return -xm;
@@ -108,9 +109,9 @@ s64 ieee754sp_tlong(ieee754sp x)
 }
 
 
-u64 ieee754sp_tulong(ieee754sp x)
+u64 ieee754sp_tulong(union ieee754sp x)
 {
-       ieee754sp hb = ieee754sp_1e63();
+       union ieee754sp hb = ieee754sp_1e63();
 
        /* what if x < 0 ?? */
        if (ieee754sp_lt(x, hb))