Fix _ftol() and move it to NTDLL i386 subdir

svn path=/trunk/; revision=4568
This commit is contained in:
Gé van Geldorp 2003-04-23 22:58:02 +00:00
parent fb8745e1ef
commit a94c5d7e28
6 changed files with 41 additions and 18 deletions

View file

@ -1,4 +1,4 @@
# $Id: Makefile,v 1.32 2003/04/06 12:40:55 gvg Exp $
# $Id: Makefile,v 1.33 2003/04/23 22:58:02 gvg Exp $
PATH_TO_TOP = ../..
@ -174,7 +174,6 @@ MATH_OBJECTS = \
math/floor.o \
math/fmod.o \
math/frexp.o \
math/ftol.o \
math/huge_val.o \
math/hypot.o \
math/j0_y0.o \

View file

@ -1,6 +0,0 @@
#include <msvcrt/float.h>
long _ftol(double fl)
{
return (long)fl;
}

View file

@ -1,4 +1,4 @@
; $Id: msvcrt.def,v 1.19 2003/04/06 12:40:55 gvg Exp $
; $Id: msvcrt.def,v 1.20 2003/04/23 22:58:02 gvg Exp $
;
; ReactOS MSVCRT Compatibility Library
;
@ -253,7 +253,7 @@ _fsopen
_fstat
_fstati64
; _ftime
_ftol
_ftol=NTDLL._ftol
_fullpath
_futime
_gcvt

View file

@ -1,4 +1,4 @@
# $Id: makefile,v 1.80 2003/04/05 09:37:44 chorns Exp $
# $Id: makefile,v 1.81 2003/04/23 22:58:02 gvg Exp $
PATH_TO_TOP = ../..
@ -28,7 +28,8 @@ DBG_OBJECTS = dbg/brkpoint.o dbg/debug.o dbg/print.o #dbg/winedbg.o
RTL_I386_OBJECTS = \
rtl/i386/exception.o \
rtl/i386/except.o
rtl/i386/except.o \
rtl/i386/ftol.o
RTL_OBJECTS = rtl/critical.o rtl/error.o rtl/heap.o rtl/largeint.o \
rtl/math.o rtl/mem.o rtl/nls.o rtl/process.o rtl/sd.o \

View file

@ -0,0 +1,35 @@
/* $Id: ftol.c,v 1.1 2003/04/23 22:58:02 gvg Exp $
*
* COPYRIGHT: See COPYING in the top level directory
* PROJECT: ReactOS kernel
* PURPOSE: Security manager
* FILE: lib/ntdll/rtl/i386/ftol.c
* PROGRAMER: Ge van Geldorp (ge@gse.nl)
* REVISION HISTORY: 2003/04/24 Created
*/
/*
* This routine is called by MSVC-generated code to convert from floating point
* to integer representation. The floating point number to be converted is
* on the top of the floating point stack.
*/
long long __cdecl _ftol(void)
{
unsigned short cw_orig;
unsigned short cw_round_chop;
long long ll;
/* Set "round towards zero" mode */
__asm__("fstcw %0\n\t" : "=m" (cw_orig));
__asm__("fwait\n\t");
cw_round_chop = cw_orig | 0x0c00;
__asm__("fldcw %0\n\t" : : "m" (cw_round_chop));
/* Do the actual conversion */
__asm__("fistpq %0\n\t" : "=m" (ll) );
/* And restore the rounding mode */
__asm__("fldcw %0\n\t" : : "m" (cw_orig));
return ll;
}

View file

@ -24,7 +24,6 @@ double ceil (double __x);
double cos (double __x);
double fabs (double __x);
double floor (double __x);
long _ftol (double fl);
double log (double __x);
double __log2 (double __x);
double pow (double __x, double __y);
@ -92,11 +91,6 @@ double floor (double __x)
return __value;
}
long _ftol (double fl)
{
return (long)fl;
}
double log (double __x)
{
register double __value;