Gregor Schneider <grschneider@gmail.com>

- Floating point values are not passed directly, but using the stack. Ref: Wine code and
http://en.wikibooks.org/wiki/Reverse_Engineering/Floating_Point_Numbers
code.
- mem/i386/memchr_asm.s: don't loop if given size is 0.
- Python test_builtin passes all 50 tests now.
See issue #1255 for more details.

svn path=/trunk/; revision=35357
This commit is contained in:
Aleksey Bragin 2008-08-15 18:24:11 +00:00
parent 8f90e11e73
commit 08c7fe628b
2 changed files with 43 additions and 38 deletions

View file

@ -1,134 +1,138 @@
#include <precomp.h> #include <precomp.h>
#include <math.h> #include <math.h>
double _CIsin(double x); #define FPU_DOUBLE(var) double var; \
double _CIcos(double x); __asm__ __volatile__( "fstpl %0;fwait" : "=m" (var) : )
double _CItan(double x); #define FPU_DOUBLES(var1,var2) double var1,var2; \
double _CIsinh(double x); __asm__ __volatile__( "fstpl %0;fwait" : "=m" (var2) : ); \
double _CIcosh(double x); __asm__ __volatile__( "fstpl %0;fwait" : "=m" (var1) : )
double _CItanh(double x);
double _CIasin(double x);
double _CIacos(double x);
double _CIatan(double x);
double _CIatan2(double y, double x);
double _CIexp(double x);
double _CIlog(double x);
double _CIlog10(double x);
double _CIpow(double x, double y);
double _CIsqrt(double x);
double _CIfmod(double x, double y);
/* /*
* @implemented * @implemented
*/ */
double _CIsin(double x) double CDECL _CIsin(void)
{ {
FPU_DOUBLE(x);
return sin(x); return sin(x);
} }
/* /*
* @implemented * @implemented
*/ */
double _CIcos(double x) double CDECL _CIcos(void)
{ {
FPU_DOUBLE(x);
return cos(x); return cos(x);
} }
/* /*
* @implemented * @implemented
*/ */
double _CItan(double x) double CDECL _CItan(void)
{ {
FPU_DOUBLE(x);
return tan(x); return tan(x);
} }
/* /*
* @implemented * @implemented
*/ */
double _CIsinh(double x) double CDECL _CIsinh(void)
{ {
FPU_DOUBLE(x);
return sinh(x); return sinh(x);
} }
/* /*
* @implemented * @implemented
*/ */
double _CIcosh(double x) double CDECL _CIcosh(void)
{ {
FPU_DOUBLE(x);
return cosh(x); return cosh(x);
} }
/* /*
* @implemented * @implemented
*/ */
double _CItanh(double x) double CDECL _CItanh(void)
{ {
FPU_DOUBLE(x);
return tanh(x); return tanh(x);
} }
/* /*
* @implemented * @implemented
*/ */
double _CIasin(double x) double CDECL _CIasin(void)
{ {
FPU_DOUBLE(x);
return asin(x); return asin(x);
} }
/* /*
* @implemented * @implemented
*/ */
double _CIacos(double x) double CDECL _CIacos(void)
{ {
FPU_DOUBLE(x);
return acos(x); return acos(x);
} }
/* /*
* @implemented * @implemented
*/ */
double _CIatan(double x) double CDECL _CIatan(void)
{ {
FPU_DOUBLE(x);
return atan(x); return atan(x);
} }
/* /*
* @implemented * @implemented
*/ */
double _CIatan2(double y, double x) double CDECL _CIatan2(void)
{ {
return atan2(y, x); FPU_DOUBLES(x, y);
return atan2(x, y);
} }
/* /*
* @implemented * @implemented
*/ */
double _CIexp(double x) double CDECL _CIexp(void)
{ {
FPU_DOUBLE(x);
return exp(x); return exp(x);
} }
/* /*
* @implemented * @implemented
*/ */
double _CIlog(double x) double CDECL _CIlog(void)
{ {
FPU_DOUBLE(x);
return log(x); return log(x);
} }
/* /*
* @implemented * @implemented
*/ */
double _CIlog10(double x) double CDECL _CIlog10(void)
{ {
FPU_DOUBLE(x);
return log10(x); return log10(x);
} }
/* /*
* @implemented * @implemented
*/ */
double _CIpow(double x, double y) double CDECL _CIpow(void)
{ {
FPU_DOUBLES(x, y);
return pow(x, y); return pow(x, y);
} }
/* /*
* @implemented * @implemented
*/ */
double _CIsqrt(double x) double CDECL _CIsqrt(void)
{ {
FPU_DOUBLE(x);
return sqrt(x); return sqrt(x);
} }
/* /*
* @implemented * @implemented
*/ */
double _CIfmod(double x, double y) double CDECL _CIfmod(void)
{ {
FPU_DOUBLES(x, y);
return fmod(x, y); return fmod(x, y);
} }

View file

@ -2,7 +2,7 @@
* *
* COPYRIGHT: See COPYING in the top level directory * COPYRIGHT: See COPYING in the top level directory
* PROJECT: ReactOS kernel * PROJECT: ReactOS kernel
* FILE: lib/string/i386/memchr.s * FILE: lib/sdk/crt/mem/i386/memchr.s
*/ */
/* /*
@ -19,13 +19,14 @@ _memchr:
mov 0xc(%ebp),%eax mov 0xc(%ebp),%eax
mov 0x10(%ebp),%ecx mov 0x10(%ebp),%ecx
cld cld
jecxz .Lnotfound
repne scasb repne scasb
je .L1 je .Lfound
.Lnotfound:
mov $1,%edi mov $1,%edi
.L1: .Lfound:
mov %edi,%eax mov %edi,%eax
dec %eax dec %eax
pop %edi pop %edi
leave leave
ret ret