diff options
Diffstat (limited to 'arch/mips/math-emu/dp_flong.c')
-rw-r--r-- | arch/mips/math-emu/dp_flong.c | 28 |
1 files changed, 8 insertions, 20 deletions
diff --git a/arch/mips/math-emu/dp_flong.c b/arch/mips/math-emu/dp_flong.c index 14fc01ec742d..a267c2e39d78 100644 --- a/arch/mips/math-emu/dp_flong.c +++ b/arch/mips/math-emu/dp_flong.c | |||
@@ -5,8 +5,6 @@ | |||
5 | * MIPS floating point support | 5 | * MIPS floating point support |
6 | * Copyright (C) 1994-2000 Algorithmics Ltd. | 6 | * Copyright (C) 1994-2000 Algorithmics Ltd. |
7 | * | 7 | * |
8 | * ######################################################################## | ||
9 | * | ||
10 | * This program is free software; you can distribute it and/or modify it | 8 | * This program is free software; you can distribute it and/or modify it |
11 | * under the terms of the GNU General Public License (Version 2) as | 9 | * under the terms of the GNU General Public License (Version 2) as |
12 | * published by the Free Software Foundation. | 10 | * published by the Free Software Foundation. |
@@ -18,21 +16,18 @@ | |||
18 | * | 16 | * |
19 | * You should have received a copy of the GNU General Public License along | 17 | * You should have received a copy of the GNU General Public License along |
20 | * with this program; if not, write to the Free Software Foundation, Inc., | 18 | * with this program; if not, write to the Free Software Foundation, Inc., |
21 | * 59 Temple Place - Suite 330, Boston MA 02111-1307, USA. | 19 | * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. |
22 | * | ||
23 | * ######################################################################## | ||
24 | */ | 20 | */ |
25 | 21 | ||
26 | |||
27 | #include "ieee754dp.h" | 22 | #include "ieee754dp.h" |
28 | 23 | ||
29 | ieee754dp ieee754dp_flong(s64 x) | 24 | union ieee754dp ieee754dp_flong(s64 x) |
30 | { | 25 | { |
31 | u64 xm; | 26 | u64 xm; |
32 | int xe; | 27 | int xe; |
33 | int xs; | 28 | int xs; |
34 | 29 | ||
35 | CLEARCX; | 30 | ieee754_clearcx(); |
36 | 31 | ||
37 | if (x == 0) | 32 | if (x == 0) |
38 | return ieee754dp_zero(0); | 33 | return ieee754dp_zero(0); |
@@ -52,26 +47,19 @@ ieee754dp ieee754dp_flong(s64 x) | |||
52 | } | 47 | } |
53 | 48 | ||
54 | /* normalize */ | 49 | /* normalize */ |
55 | xe = DP_MBITS + 3; | 50 | xe = DP_FBITS + 3; |
56 | if (xm >> (DP_MBITS + 1 + 3)) { | 51 | if (xm >> (DP_FBITS + 1 + 3)) { |
57 | /* shunt out overflow bits */ | 52 | /* shunt out overflow bits */ |
58 | while (xm >> (DP_MBITS + 1 + 3)) { | 53 | while (xm >> (DP_FBITS + 1 + 3)) { |
59 | XDPSRSX1(); | 54 | XDPSRSX1(); |
60 | } | 55 | } |
61 | } else { | 56 | } else { |
62 | /* normalize in grs extended double precision */ | 57 | /* normalize in grs extended double precision */ |
63 | while ((xm >> (DP_MBITS + 3)) == 0) { | 58 | while ((xm >> (DP_FBITS + 3)) == 0) { |
64 | xm <<= 1; | 59 | xm <<= 1; |
65 | xe--; | 60 | xe--; |
66 | } | 61 | } |
67 | } | 62 | } |
68 | DPNORMRET1(xs, xe, xm, "dp_flong", x); | ||
69 | } | ||
70 | 63 | ||
71 | ieee754dp ieee754dp_fulong(u64 u) | 64 | return ieee754dp_format(xs, xe, xm); |
72 | { | ||
73 | if ((s64) u < 0) | ||
74 | return ieee754dp_add(ieee754dp_1e63(), | ||
75 | ieee754dp_flong(u & ~(1ULL << 63))); | ||
76 | return ieee754dp_flong(u); | ||
77 | } | 65 | } |