3 * COPYRIGHT: See COPYING in the top level directory
4 * PROJECT: ReactOS kernel
5 * PURPOSE: Security manager
6 * FILE: lib/ntdll/rtl/i386/ftol.c
7 * PROGRAMER: Ge van Geldorp (ge@gse.nl)
8 * REVISION HISTORY: 2003/04/24 Created
12 * This routine is called by MSVC-generated code to convert from floating point
13 * to integer representation. The floating point number to be converted is
14 * on the top of the floating point stack.
16 long long __cdecl
_ftol(void)
18 unsigned short cw_orig
;
19 unsigned short cw_round_chop
;
22 /* Set "round towards zero" mode */
23 __asm__("fstcw %0\n\t" : "=m" (cw_orig
));
25 cw_round_chop
= cw_orig
| 0x0c00;
26 __asm__("fldcw %0\n\t" : : "m" (cw_round_chop
));
28 /* Do the actual conversion */
29 __asm__("fistpq %0\n\t" : "=m" (ll
) );
31 /* And restore the rounding mode */
32 __asm__("fldcw %0\n\t" : : "m" (cw_orig
));