2 Copyright © 1995-2003, The AROS Development Team. All rights reserved.
6 #include "mathieeedoubbas_intern.h"
10 Convert IEEE double precision floating point number to integer
17 negative : result is negative
18 overflow : ieeedp out of integer-range
33 AROS_LHQUAD1(LONG
, IEEEDPFix
,
34 AROS_LHAQUAD(double, y
, D0
, D1
),
35 struct MathIeeeDoubBasBase
*, MathIeeeDoubBasBase
, 5, MathIeeeDoubBas
42 QUAD
* Qy
= (QUAD
*)&y
;
44 tmp
= Get_High32of64(*Qy
) & IEEEDPExponent_Mask_Hi
;
46 if ( tmp
> 0x41d00000 )
48 if( is_lessSC(*Qy
, 0x0, 0x0))
50 SetSR(Overflow_Bit
, Zero_Bit
| Negative_Bit
| Overflow_Bit
);
55 SetSR(Overflow_Bit
, Zero_Bit
| Negative_Bit
| Overflow_Bit
);
63 || is_eqC(*Qy
,IEEEDPSign_Mask_Hi
, IEEEDPSign_Mask_Lo
)
66 SetSR(Zero_Bit
, Zero_Bit
| Negative_Bit
| Overflow_Bit
);
70 Shift
= (Get_High32of64(*Qy
) & IEEEDPExponent_Mask_Hi
) >> 20;
71 Shift
= 0x433 - Shift
;
72 tmp
= Get_High32of64(*Qy
);
73 AND64QC(*Qy
, IEEEDPMantisse_Mask_Hi
, IEEEDPMantisse_Mask_Lo
);
74 OR64QC(*Qy
, 0x00100000, 0x00000000);
75 SHRU64(y2
, *Qy
, Shift
);
76 Res
= Get_Low32of64(y2
);
78 /* Test for a negative sign */
79 if (tmp
< 0) /* y < 0 */
82 SetSR(Negative_Bit
, Zero_Bit
| Negative_Bit
| Overflow_Bit
);