2 Copyright © 1995-2004, The AROS Development Team. All rights reserved.
6 #include "mathffp_intern.h"
10 Convert ffp-number to integer
13 absolute value of fnum1
17 negative : result is negative
18 overflow : ffp out of integer-range
35 AROS_LHA(float, fnum
, D0
),
36 struct LibHeader
*, MathBase
, 5, Mathffp
44 if ((fnum
& FFPExponent_Mask
) > 0x60 )
46 if(fnum
< 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
);
59 Shift
= (fnum
& FFPExponent_Mask
) - 0x40;
60 Res
= ((ULONG
)(fnum
& FFPMantisse_Mask
)) >> (32 - Shift
);
64 SetSR(Zero_Bit
, Zero_Bit
| Negative_Bit
| Overflow_Bit
);
68 if (0x80000000 == Res
) return 0x7fffffff;
71 /* Test for a negative sign */
75 SetSR(Negative_Bit
, Zero_Bit
| Negative_Bit
| Overflow_Bit
);
78 kprintf("SPFix(%x)=%d\n",fnum
,Res
);