2 Copyright © 1995-2004, The AROS Development Team. All rights reserved.
6 #include "mathieeesingbas_intern.h"
8 /*****************************************************************************
12 AROS_LH1(LONG
, IEEESPFix
,
15 AROS_LHA(float, y
, D0
),
18 struct LibHeader
*, MathIeeeSingBasBase
, 5, Mathieeesingbas
)
21 Convert ieeesp-number to integer
30 negative : result is negative
31 overflow : ieeesp out of integer-range
37 *****************************************************************************/
44 if ((y
& IEEESPExponent_Mask
) > 0x60000000 )
46 if(y
< 0) /* don`t hurt the SR! */
48 SetSR(Overflow_Bit
, Zero_Bit
| Negative_Bit
| Overflow_Bit
);
53 SetSR(Overflow_Bit
, Zero_Bit
| Negative_Bit
| Overflow_Bit
);
58 if (0 == y
|| 0x80000000 == y
) /* y=+-0; */
60 SetSR(Zero_Bit
, Zero_Bit
| Negative_Bit
| Overflow_Bit
);
64 Shift
= (y
& IEEESPExponent_Mask
) >> 23;
67 if ((char) Shift
>= 25)
69 Res
= ((y
& IEEESPMantisse_Mask
) | 0x00800000) << (Shift
-24);
73 Res
= ((y
& IEEESPMantisse_Mask
) | 0x00800000) >> (24 - Shift
);
76 /* Test for a negative sign */
80 SetSR(Negative_Bit
, Zero_Bit
| Negative_Bit
| Overflow_Bit
);