Updated PCI IDs to latest snapshot.
[tangerine.git] / workbench / libs / mathieeedoubtrans / ieeedpfieee.c
blob749d7cfd90a9df820dc02442011159590ba2d4aa
1 /*
2 Copyright © 1995-2003, The AROS Development Team. All rights reserved.
3 $Id$
4 */
6 #include "mathieeedoubtrans_intern.h"
8 /*
9 FUNCTION
10 Convert IEEE single to IEEE double precision
12 RESULT
13 IEEE double precision floting point number
15 Flags:
16 zero : result is zero
17 negative : result is negative
18 overflow : 0
20 NOTES
22 EXAMPLE
24 BUGS
26 SEE ALSO
28 INTERNALS
30 HISTORY
33 AROS_LHQUAD1(double, IEEEDPFieee,
34 AROS_LHAQUAD(LONG, y, D0, D1),
35 struct MathIeeeDoubTransBase *, MathIeeeDoubTransBase, 18, MathIeeeDoubTrans
38 AROS_LIBFUNC_INIT
40 LONG tmpL = y & IEEESPExponent_Mask; /* get the Exponent */
41 QUAD Res, tmpQ;
43 SetSR( 0, Zero_Bit | Overflow_Bit | Negative_Bit);
45 if (0 == y)
47 SetSR( Zero_Bit, Zero_Bit | Overflow_Bit | Negative_Bit);
48 Set_Value64C(Res, 0x0, 0x0);
49 return Res;
52 tmpL >>= 23;
53 tmpL = tmpL - 0x7e + 0x3fe;
55 /* set the Exponent */
56 SHL32(Res, tmpL, 52);
58 /* set the Mantisse */
59 tmpL = y & IEEESPMantisse_Mask;
60 SHL32(tmpQ, tmpL, 29);
61 OR64Q(Res, tmpQ);
63 if (y < 0)
65 OR64QC(Res, IEEEDPSign_Mask_Hi, IEEEDPSign_Mask_Lo);
66 SetSR( Negative_Bit, Zero_Bit | Overflow_Bit | Negative_Bit);
69 return Res;
71 AROS_LIBFUNC_EXIT