2 Copyright © 1995-2004, The AROS Development Team. All rights reserved.
6 #include "mathffp_intern.h"
8 /*****************************************************************************
15 AROS_LHA(float, fnum
, D0
),
18 struct LibHeader
*, MathBase
, 5, Mathffp
)
21 Convert ffp-number to integer
26 absolute value of fnum1
30 negative : result is negative
31 overflow : ffp out of integer-range
37 *****************************************************************************/
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 if (Shift
> 0) /* > 32 bit LONG shift = undefined */
61 Res
= ((ULONG
)(fnum
& FFPMantisse_Mask
)) >> (32 - Shift
);
67 SetSR(Zero_Bit
, Zero_Bit
| Negative_Bit
| Overflow_Bit
);
71 if (0x80000000 == Res
) return 0x7fffffff;
74 /* Test for a negative sign */
78 SetSR(Negative_Bit
, Zero_Bit
| Negative_Bit
| Overflow_Bit
);
81 D(kprintf("SPFix(%x) = %d\n", fnum
, Res
));