mirror of
https://github.com/reactos/reactos.git
synced 2025-07-03 01:31:26 +00:00
Revert r45245 - r45247
Although the idea of using mingw-w64's routines is good, we can't because it's using x87. We need SSE2. svn path=/branches/ros-amd64-bringup/; revision=45255
This commit is contained in:
parent
3ec17c4a18
commit
9c9f4a9fd7
85 changed files with 2786 additions and 2128 deletions
|
@ -22,7 +22,6 @@
|
|||
<define name="__MINGW_IMPORT">extern</define>
|
||||
<define name="USE_MSVCRT_PREFIX" />
|
||||
<define name="_MSVCRT_LIB_" />
|
||||
<define name="_CRTBLD" />
|
||||
<define name="_MSVCRT_" />
|
||||
<define name="_MT" />
|
||||
<directory name="conio">
|
||||
|
@ -107,84 +106,87 @@
|
|||
<file>locale.c</file>
|
||||
</directory>
|
||||
<directory name="math">
|
||||
<file>abs.c</file>
|
||||
<file>acos.c</file>
|
||||
<file>acosf.c</file>
|
||||
<file>adjust.c</file>
|
||||
<file>asin.c</file>
|
||||
<file>asinf.c</file>
|
||||
<file>atan.c</file>
|
||||
<file>atan2.c</file>
|
||||
<file>atan2f.c</file>
|
||||
<file>atanf.c</file>
|
||||
<file>cabs.c</file>
|
||||
<file>copysign.c</file>
|
||||
<file>copysignf.c</file>
|
||||
<file>cosf.c</file>
|
||||
<file>cosh.c</file>
|
||||
<file>div.c</file>
|
||||
<file>exp.c</file>
|
||||
<file>expf.c</file>
|
||||
<file>fabs.c</file>
|
||||
<file>fdivbug.c</file>
|
||||
<file>fmod.c</file>
|
||||
<file>fmodf.c</file>
|
||||
<file>frexp.c</file>
|
||||
<file>huge_val.c</file>
|
||||
<file>hypot.c</file>
|
||||
<file>hypotf.c</file>
|
||||
<file>ldexp.c</file>
|
||||
<file>ldiv.c</file>
|
||||
<file>log10f.c</file>
|
||||
<file>logb.c</file>
|
||||
<file>logbf.c</file>
|
||||
<file>logf.c</file>
|
||||
<file>modf.c</file>
|
||||
<file>modff.c</file>
|
||||
<file>nextafter.c</file>
|
||||
<file>nextafterf.c</file>
|
||||
<file>powf.c</file>
|
||||
<file>rand.c</file>
|
||||
<file>s_modf.c</file>
|
||||
<file>sinf.c</file>
|
||||
<file>sinh.c</file>
|
||||
<file>sinhf.c</file>
|
||||
<file>sqrt.c</file>
|
||||
<file>sqrtf.c</file>
|
||||
<file>tanf.c</file>
|
||||
<file>tanh.c</file>
|
||||
<file>tanhf.c</file>
|
||||
<file>pow_asm.c</file>
|
||||
|
||||
<if property="ARCH" value="i386">
|
||||
<directory name="i386">
|
||||
<file>ceil.S</file>
|
||||
<file>ceilf.S</file>
|
||||
<file>cos.S</file>
|
||||
<file>floor.S</file>
|
||||
<file>floorf.S</file>
|
||||
<file>log.S</file>
|
||||
<file>log10.S</file>
|
||||
<file>sin.S</file>
|
||||
<file>tan.S</file>
|
||||
<file>ci.c</file>
|
||||
<file>alldiv_asm.s</file>
|
||||
<file>alldvrm_asm.s</file>
|
||||
<file>allmul_asm.s</file>
|
||||
<file>allrem_asm.s</file>
|
||||
<file>allshl_asm.s</file>
|
||||
<file>allshr_asm.s</file>
|
||||
<file>atan_asm.s</file>
|
||||
<file>aulldiv_asm.s</file>
|
||||
<file>aulldvrm_asm.s</file>
|
||||
<file>aullrem_asm.s</file>
|
||||
<file>aullshr_asm.s</file>
|
||||
<file>ceil_asm.s</file>
|
||||
<file>cos_asm.s</file>
|
||||
<file>fabs_asm.s</file>
|
||||
<file>floor_asm.s</file>
|
||||
<file>ftol_asm.s</file>
|
||||
<file>log_asm.s</file>
|
||||
<file>log10_asm.s</file>
|
||||
<file>pow_asm.s</file>
|
||||
<file>sin_asm.s</file>
|
||||
<file>sqrt_asm.s</file>
|
||||
<file>tan_asm.s</file>
|
||||
|
||||
<file>atan2.c</file>
|
||||
<file>ci.c</file>
|
||||
<file>exp.c</file>
|
||||
<file>fmod.c</file>
|
||||
<file>ldexp.c</file>
|
||||
</directory>
|
||||
<!-- FIXME: we don't actually implement these... they recursively call themselves through an alias -->
|
||||
<!--<file>j0_y0.c</file>
|
||||
<file>j1_y1.c</file>
|
||||
<file>jn_yn.c</file>-->
|
||||
</if>
|
||||
<if property="ARCH" value="amd64">
|
||||
<directory name="i386">
|
||||
<directory name="amd64">
|
||||
<file>alldiv.S</file>
|
||||
<file>atan.S</file>
|
||||
<file>atan2.S</file>
|
||||
<file>ceil.S</file>
|
||||
<file>ceilf.S</file>
|
||||
<file>cos.S</file>
|
||||
<file>exp.S</file>
|
||||
<file>fabs.S</file>
|
||||
<file>floor.S</file>
|
||||
<file>floorf.S</file>
|
||||
<file>fmod.S</file>
|
||||
<file>fmodf.S</file>
|
||||
<file>ldexp.S</file>
|
||||
<file>log.S</file>
|
||||
<file>log10.S</file>
|
||||
<file>sin.S</file>
|
||||
<file>tan.S</file>
|
||||
<file>ci.c</file>
|
||||
</directory>
|
||||
<directory name="amd64">
|
||||
<file>pow.S</file>
|
||||
<file>sin.S</file>
|
||||
<file>sqrt.S</file>
|
||||
<file>sqrtf.S</file>
|
||||
<file>tan.S</file>
|
||||
</directory>
|
||||
<!-- FIXME: we don't actually implement these... they recursively call themselves through an alias -->
|
||||
<!--<file>j0_y0.c</file>
|
||||
<file>j1_y1.c</file>
|
||||
<file>jn_yn.c</file>-->
|
||||
</if>
|
||||
<ifnot property="ARCH" value="i386">
|
||||
<file>stubs.c</file>
|
||||
|
|
|
@ -491,11 +491,3 @@ unsigned int CDECL __CxxQueryExceptionSize(void)
|
|||
{
|
||||
return sizeof(cxx_exception_type);
|
||||
}
|
||||
|
||||
/******************************************************************
|
||||
* MSVCRT___uncaught_exception
|
||||
*/
|
||||
BOOL CDECL __uncaught_exception(void)
|
||||
{
|
||||
return FALSE;
|
||||
}
|
||||
|
|
|
@ -1,7 +1,6 @@
|
|||
#define WIN32_NO_STATUS
|
||||
#include <precomp.h>
|
||||
#include <windows.h>
|
||||
#include <setjmp.h>
|
||||
#define NTOS_MODE_USER
|
||||
#include <ndk/umtypes.h>
|
||||
#include <ndk/extypes.h>
|
||||
|
@ -26,6 +25,23 @@ typedef struct _MSVCRT_EXCEPTION_FRAME
|
|||
PEXCEPTION_POINTERS xpointers;
|
||||
} MSVCRT_EXCEPTION_FRAME;
|
||||
|
||||
|
||||
typedef struct __JUMP_BUFFER
|
||||
{
|
||||
unsigned long Ebp;
|
||||
unsigned long Ebx;
|
||||
unsigned long Edi;
|
||||
unsigned long Esi;
|
||||
unsigned long Esp;
|
||||
unsigned long Eip;
|
||||
unsigned long Registration;
|
||||
unsigned long TryLevel;
|
||||
/* Start of new struct members */
|
||||
unsigned long Cookie;
|
||||
unsigned long UnwindFunc;
|
||||
unsigned long UnwindData[6];
|
||||
} _JUMP_BUFFER;
|
||||
|
||||
void
|
||||
_local_unwind2(MSVCRT_EXCEPTION_FRAME *RegistrationFrame,
|
||||
LONG TryLevel);
|
||||
|
|
|
@ -6,7 +6,6 @@
|
|||
<define name="NO_RTL_INLINES" />
|
||||
<define name="_NTSYSTEM_" />
|
||||
<define name="_NTDLLBUILD_" />
|
||||
<define name="_CRTBLD" />
|
||||
<define name="_LIBCNT_" />
|
||||
<if property="ARCH" value="i386">
|
||||
<define name="__MINGW_IMPORT">"extern __attribute__ ((dllexport))"</define>
|
||||
|
@ -41,44 +40,48 @@
|
|||
<file>allrem_asm.s</file>
|
||||
<file>allshl_asm.s</file>
|
||||
<file>allshr_asm.s</file>
|
||||
<file>atan_asm.s</file>
|
||||
<file>aulldiv_asm.s</file>
|
||||
<file>aulldvrm_asm.s</file>
|
||||
<file>aullrem_asm.s</file>
|
||||
<file>aullshr_asm.s</file>
|
||||
<file>ci.c</file>
|
||||
<file>ceil_asm.s</file>
|
||||
<file>cos_asm.s</file>
|
||||
<file>fabs_asm.s</file>
|
||||
<file>floor_asm.s</file>
|
||||
<file>ftol_asm.s</file>
|
||||
<file>log_asm.s</file>
|
||||
<file>pow_asm.s</file>
|
||||
<file>ceil.S</file>
|
||||
<file>cos.S</file>
|
||||
<file>log.S</file>
|
||||
<file>log10.S</file>
|
||||
<file>sin.S</file>
|
||||
<file>tan.S</file>
|
||||
<file>sin_asm.s</file>
|
||||
<file>sqrt_asm.s</file>
|
||||
<file>tan_asm.s</file>
|
||||
</directory>
|
||||
</if>
|
||||
<if property="ARCH" value="amd64">
|
||||
<directory name="i386">
|
||||
<file>ceil.S</file>
|
||||
<file>cos.S</file>
|
||||
<file>floor.S</file>
|
||||
<file>log.S</file>
|
||||
<file>log10.S</file>
|
||||
<file>sin.S</file>
|
||||
<file>tan.S</file>
|
||||
</directory>
|
||||
<directory name="amd64">
|
||||
<file>alldiv.S</file>
|
||||
<file>atan.S</file>
|
||||
<file>atan2.S</file>
|
||||
<file>ceil.S</file>
|
||||
<file>cos.S</file>
|
||||
<file>exp.S</file>
|
||||
<file>fabs.S</file>
|
||||
<file>floor.S</file>
|
||||
<file>fmod.S</file>
|
||||
<file>ldexp.S</file>
|
||||
<file>log.S</file>
|
||||
<file>log10.S</file>
|
||||
<file>pow.S</file>
|
||||
<file>sin.S</file>
|
||||
<file>sqrt.S</file>
|
||||
<file>tan.S</file>
|
||||
</directory>
|
||||
</if>
|
||||
<file>abs.c</file>
|
||||
<file>atan.c</file>
|
||||
<file>fabs.c</file>
|
||||
<file>div.c</file>
|
||||
<file>labs.c</file>
|
||||
<file>rand_nt.c</file>
|
||||
<file>sqrt.c</file>
|
||||
</directory>
|
||||
|
||||
<directory name="mem">
|
||||
|
@ -204,4 +207,4 @@
|
|||
<file>wcsspn.c</file>
|
||||
<file>wcsstr.c</file>
|
||||
</directory>
|
||||
</module>
|
||||
</module>
|
||||
|
|
|
@ -1,29 +0,0 @@
|
|||
/**
|
||||
* This file has no copyright assigned and is placed in the Public Domain.
|
||||
* This file is part of the w64 mingw-runtime package.
|
||||
* No warranty is given; refer to the file DISCLAIMER.PD within this package.
|
||||
*/
|
||||
/*
|
||||
* Written by J.T. Conklin <jtc@netbsd.org>.
|
||||
* Public domain.
|
||||
*/
|
||||
|
||||
#include <math.h>
|
||||
|
||||
float
|
||||
acosf (float x)
|
||||
{
|
||||
float res = 0.0F;
|
||||
#ifdef __GNUC__
|
||||
/* acosl = atanl (sqrtl(1 - x^2) / x) */
|
||||
asm ( "fld %%st\n\t"
|
||||
"fmul %%st(0)\n\t" /* x^2 */
|
||||
"fld1\n\t"
|
||||
"fsubp\n\t" /* 1 - x^2 */
|
||||
"fsqrt\n\t" /* sqrtl (1 - x^2) */
|
||||
"fxch %%st(1)\n\t"
|
||||
"fpatan"
|
||||
: "=t" (res) : "0" (x) : "st(1)");
|
||||
#endif
|
||||
return res;
|
||||
}
|
21
reactos/lib/sdk/crt/math/amd64/atan.S
Normal file
21
reactos/lib/sdk/crt/math/amd64/atan.S
Normal file
|
@ -0,0 +1,21 @@
|
|||
/*
|
||||
* COPYRIGHT: See COPYING in the top level directory
|
||||
* PROJECT: ReactOS system libraries
|
||||
* PURPOSE: Implementation of atan
|
||||
* FILE: lib/sdk/crt/math/amd64/atan.S
|
||||
* PROGRAMMER: Timo Kreuzer (timo.kreuzer@reactos.org)
|
||||
*/
|
||||
|
||||
/* INCLUDES ******************************************************************/
|
||||
|
||||
#include <ndk/amd64/asm.h>
|
||||
#include <ndk/amd64/asmmacro.S>
|
||||
|
||||
.intel_syntax noprefix
|
||||
|
||||
|
||||
.proc atan
|
||||
UNIMPLEMENTED atan
|
||||
ret
|
||||
|
||||
.endproc
|
21
reactos/lib/sdk/crt/math/amd64/atan2.S
Normal file
21
reactos/lib/sdk/crt/math/amd64/atan2.S
Normal file
|
@ -0,0 +1,21 @@
|
|||
/*
|
||||
* COPYRIGHT: See COPYING in the top level directory
|
||||
* PROJECT: ReactOS system libraries
|
||||
* PURPOSE: Implementation of atan2
|
||||
* FILE: lib/sdk/crt/math/amd64/atan2.S
|
||||
* PROGRAMMER: Timo Kreuzer (timo.kreuzer@reactos.org)
|
||||
*/
|
||||
|
||||
/* INCLUDES ******************************************************************/
|
||||
|
||||
#include <ndk/amd64/asm.h>
|
||||
#include <ndk/amd64/asmmacro.S>
|
||||
|
||||
.intel_syntax noprefix
|
||||
|
||||
|
||||
.proc atan2
|
||||
UNIMPLEMENTED atan2
|
||||
ret
|
||||
|
||||
.endproc
|
21
reactos/lib/sdk/crt/math/amd64/ceil.S
Normal file
21
reactos/lib/sdk/crt/math/amd64/ceil.S
Normal file
|
@ -0,0 +1,21 @@
|
|||
/*
|
||||
* COPYRIGHT: See COPYING in the top level directory
|
||||
* PROJECT: ReactOS system libraries
|
||||
* PURPOSE: Implementation of ceil
|
||||
* FILE: lib/sdk/crt/math/amd64/ceil.S
|
||||
* PROGRAMMER: Timo Kreuzer (timo.kreuzer@reactos.org)
|
||||
*/
|
||||
|
||||
/* INCLUDES ******************************************************************/
|
||||
|
||||
#include <ndk/amd64/asm.h>
|
||||
#include <ndk/amd64/asmmacro.S>
|
||||
|
||||
.intel_syntax noprefix
|
||||
|
||||
|
||||
.proc ceil
|
||||
UNIMPLEMENTED ceil
|
||||
ret
|
||||
|
||||
.endproc
|
40
reactos/lib/sdk/crt/math/amd64/ceilf.S
Normal file
40
reactos/lib/sdk/crt/math/amd64/ceilf.S
Normal file
|
@ -0,0 +1,40 @@
|
|||
/*
|
||||
* COPYRIGHT: See COPYING in the top level directory
|
||||
* PROJECT: ReactOS system libraries
|
||||
* PURPOSE: Implementation of tan
|
||||
* FILE: lib/sdk/crt/math/amd64/ceilf.S
|
||||
* PROGRAMMER: Timo Kreuzer (timo.kreuzer@reactos.org)
|
||||
*/
|
||||
|
||||
/* INCLUDES ******************************************************************/
|
||||
|
||||
#include <ndk/amd64/asm.h>
|
||||
#include <ndk/amd64/asmmacro.S>
|
||||
|
||||
.intel_syntax noprefix
|
||||
|
||||
|
||||
.proc ceilf
|
||||
/* Put parameter on the stack */
|
||||
movss [rsp - 0x10], xmm0
|
||||
fld dword ptr [rsp]
|
||||
|
||||
/* Change fpu control word to round up */
|
||||
fstcw [rsp - 0x10]
|
||||
mov eax, [rsp - 0x10]
|
||||
or eax, 0x00800
|
||||
and eax, 0x0fbff
|
||||
mov [rsp - 0x08], eax
|
||||
fldcw [rsp - 0x08]
|
||||
|
||||
/* Round to integer */
|
||||
frndint
|
||||
|
||||
/* Restore fpu control word */
|
||||
fldcw [rsp - 0x10]
|
||||
|
||||
fstp dword ptr [rsp - 0x10]
|
||||
movss xmm0, [rsp - 0x10]
|
||||
ret
|
||||
|
||||
.endproc
|
21
reactos/lib/sdk/crt/math/amd64/cos.S
Normal file
21
reactos/lib/sdk/crt/math/amd64/cos.S
Normal file
|
@ -0,0 +1,21 @@
|
|||
/*
|
||||
* COPYRIGHT: See COPYING in the top level directory
|
||||
* PROJECT: ReactOS system libraries
|
||||
* PURPOSE: Implementation of cos
|
||||
* FILE: lib/sdk/crt/math/amd64/cos.S
|
||||
* PROGRAMMER: Timo Kreuzer (timo.kreuzer@reactos.org)
|
||||
*/
|
||||
|
||||
/* INCLUDES ******************************************************************/
|
||||
|
||||
#include <ndk/amd64/asm.h>
|
||||
#include <ndk/amd64/asmmacro.S>
|
||||
|
||||
.intel_syntax noprefix
|
||||
|
||||
|
||||
.proc cos
|
||||
UNIMPLEMENTED cos
|
||||
ret
|
||||
|
||||
.endproc
|
21
reactos/lib/sdk/crt/math/amd64/exp.S
Normal file
21
reactos/lib/sdk/crt/math/amd64/exp.S
Normal file
|
@ -0,0 +1,21 @@
|
|||
/*
|
||||
* COPYRIGHT: See COPYING in the top level directory
|
||||
* PROJECT: ReactOS system libraries
|
||||
* PURPOSE: Implementation of exp
|
||||
* FILE: lib/sdk/crt/math/amd64/exp.S
|
||||
* PROGRAMMER: Timo Kreuzer (timo.kreuzer@reactos.org)
|
||||
*/
|
||||
|
||||
/* INCLUDES ******************************************************************/
|
||||
|
||||
#include <ndk/amd64/asm.h>
|
||||
#include <ndk/amd64/asmmacro.S>
|
||||
|
||||
.intel_syntax noprefix
|
||||
|
||||
|
||||
.proc exp
|
||||
UNIMPLEMENTED exp
|
||||
ret
|
||||
|
||||
.endproc
|
21
reactos/lib/sdk/crt/math/amd64/fabs.S
Normal file
21
reactos/lib/sdk/crt/math/amd64/fabs.S
Normal file
|
@ -0,0 +1,21 @@
|
|||
/*
|
||||
* COPYRIGHT: See COPYING in the top level directory
|
||||
* PROJECT: ReactOS system libraries
|
||||
* PURPOSE: Implementation of fabs
|
||||
* FILE: lib/sdk/crt/math/amd64/fabs.S
|
||||
* PROGRAMMER: Timo Kreuzer (timo.kreuzer@reactos.org)
|
||||
*/
|
||||
|
||||
/* INCLUDES ******************************************************************/
|
||||
|
||||
#include <ndk/amd64/asm.h>
|
||||
#include <ndk/amd64/asmmacro.S>
|
||||
|
||||
.intel_syntax noprefix
|
||||
|
||||
|
||||
.proc fabs
|
||||
UNIMPLEMENTED fabs
|
||||
ret
|
||||
|
||||
.endproc
|
21
reactos/lib/sdk/crt/math/amd64/floor.S
Normal file
21
reactos/lib/sdk/crt/math/amd64/floor.S
Normal file
|
@ -0,0 +1,21 @@
|
|||
/*
|
||||
* COPYRIGHT: See COPYING in the top level directory
|
||||
* PROJECT: ReactOS system libraries
|
||||
* PURPOSE: Implementation of floor
|
||||
* FILE: lib/sdk/crt/math/amd64/floor.S
|
||||
* PROGRAMMER: Timo Kreuzer (timo.kreuzer@reactos.org)
|
||||
*/
|
||||
|
||||
/* INCLUDES ******************************************************************/
|
||||
|
||||
#include <ndk/amd64/asm.h>
|
||||
#include <ndk/amd64/asmmacro.S>
|
||||
|
||||
.intel_syntax noprefix
|
||||
|
||||
|
||||
.proc floor
|
||||
UNIMPLEMENTED floor
|
||||
ret
|
||||
|
||||
.endproc
|
40
reactos/lib/sdk/crt/math/amd64/floorf.S
Normal file
40
reactos/lib/sdk/crt/math/amd64/floorf.S
Normal file
|
@ -0,0 +1,40 @@
|
|||
/*
|
||||
* COPYRIGHT: See COPYING in the top level directory
|
||||
* PROJECT: ReactOS system libraries
|
||||
* PURPOSE: Implementation of tan
|
||||
* FILE: lib/sdk/crt/math/amd64/floorf.S
|
||||
* PROGRAMMER: Timo Kreuzer (timo.kreuzer@reactos.org)
|
||||
*/
|
||||
|
||||
/* INCLUDES ******************************************************************/
|
||||
|
||||
#include <ndk/amd64/asm.h>
|
||||
#include <ndk/amd64/asmmacro.S>
|
||||
|
||||
.intel_syntax noprefix
|
||||
|
||||
|
||||
.proc floorf
|
||||
/* Put parameter on the stack */
|
||||
movss [rsp - 0x10], xmm0
|
||||
fld dword ptr [rsp]
|
||||
|
||||
/* Change fpu control word to round down */
|
||||
fstcw [rsp - 0x10]
|
||||
mov eax, [rsp - 0x10]
|
||||
or eax, 0x00400
|
||||
and eax, 0x0f7ff
|
||||
mov [rsp - 0x08], eax
|
||||
fldcw [rsp - 0x08]
|
||||
|
||||
/* Round to integer */
|
||||
frndint
|
||||
|
||||
/* Restore fpu control word */
|
||||
fldcw [rsp - 0x10]
|
||||
|
||||
fstp dword ptr [rsp - 0x10]
|
||||
movss xmm0, [rsp - 0x10]
|
||||
ret
|
||||
|
||||
.endproc
|
21
reactos/lib/sdk/crt/math/amd64/fmod.S
Normal file
21
reactos/lib/sdk/crt/math/amd64/fmod.S
Normal file
|
@ -0,0 +1,21 @@
|
|||
/*
|
||||
* COPYRIGHT: See COPYING in the top level directory
|
||||
* PROJECT: ReactOS system libraries
|
||||
* PURPOSE: Implementation of fmod
|
||||
* FILE: lib/sdk/crt/math/amd64/fmod.S
|
||||
* PROGRAMMER: Timo Kreuzer (timo.kreuzer@reactos.org)
|
||||
*/
|
||||
|
||||
/* INCLUDES ******************************************************************/
|
||||
|
||||
#include <ndk/amd64/asm.h>
|
||||
#include <ndk/amd64/asmmacro.S>
|
||||
|
||||
.intel_syntax noprefix
|
||||
|
||||
|
||||
.proc fmod
|
||||
UNIMPLEMENTED fmod
|
||||
ret
|
||||
|
||||
.endproc
|
21
reactos/lib/sdk/crt/math/amd64/fmodf.S
Normal file
21
reactos/lib/sdk/crt/math/amd64/fmodf.S
Normal file
|
@ -0,0 +1,21 @@
|
|||
/*
|
||||
* COPYRIGHT: See COPYING in the top level directory
|
||||
* PROJECT: ReactOS system libraries
|
||||
* PURPOSE: Implementation of fmodf
|
||||
* FILE: lib/sdk/crt/math/amd64/fmodf.S
|
||||
* PROGRAMMER: Timo Kreuzer (timo.kreuzer@reactos.org)
|
||||
*/
|
||||
|
||||
/* INCLUDES ******************************************************************/
|
||||
|
||||
#include <ndk/amd64/asm.h>
|
||||
#include <ndk/amd64/asmmacro.S>
|
||||
|
||||
.intel_syntax noprefix
|
||||
|
||||
|
||||
.proc fmodf
|
||||
UNIMPLEMENTED fmodf
|
||||
ret
|
||||
|
||||
.endproc
|
21
reactos/lib/sdk/crt/math/amd64/ldexp.S
Normal file
21
reactos/lib/sdk/crt/math/amd64/ldexp.S
Normal file
|
@ -0,0 +1,21 @@
|
|||
/*
|
||||
* COPYRIGHT: See COPYING in the top level directory
|
||||
* PROJECT: ReactOS system libraries
|
||||
* PURPOSE: Implementation of ldexp
|
||||
* FILE: lib/sdk/crt/math/amd64/ldexp.S
|
||||
* PROGRAMMER: Timo Kreuzer (timo.kreuzer@reactos.org)
|
||||
*/
|
||||
|
||||
/* INCLUDES ******************************************************************/
|
||||
|
||||
#include <ndk/amd64/asm.h>
|
||||
#include <ndk/amd64/asmmacro.S>
|
||||
|
||||
.intel_syntax noprefix
|
||||
|
||||
|
||||
.proc ldexp
|
||||
UNIMPLEMENTED ldexp
|
||||
ret
|
||||
|
||||
.endproc
|
21
reactos/lib/sdk/crt/math/amd64/log.S
Normal file
21
reactos/lib/sdk/crt/math/amd64/log.S
Normal file
|
@ -0,0 +1,21 @@
|
|||
/*
|
||||
* COPYRIGHT: See COPYING in the top level directory
|
||||
* PROJECT: ReactOS system libraries
|
||||
* PURPOSE: Implementation of log
|
||||
* FILE: lib/sdk/crt/math/amd64/log.S
|
||||
* PROGRAMMER: Timo Kreuzer (timo.kreuzer@reactos.org)
|
||||
*/
|
||||
|
||||
/* INCLUDES ******************************************************************/
|
||||
|
||||
#include <ndk/amd64/asm.h>
|
||||
#include <ndk/amd64/asmmacro.S>
|
||||
|
||||
.intel_syntax noprefix
|
||||
|
||||
|
||||
.proc log
|
||||
UNIMPLEMENTED log
|
||||
ret
|
||||
|
||||
.endproc
|
21
reactos/lib/sdk/crt/math/amd64/log10.S
Normal file
21
reactos/lib/sdk/crt/math/amd64/log10.S
Normal file
|
@ -0,0 +1,21 @@
|
|||
/*
|
||||
* COPYRIGHT: See COPYING in the top level directory
|
||||
* PROJECT: ReactOS system libraries
|
||||
* PURPOSE: Implementation of log10
|
||||
* FILE: lib/sdk/crt/math/amd64/log10.S
|
||||
* PROGRAMMER: Timo Kreuzer (timo.kreuzer@reactos.org)
|
||||
*/
|
||||
|
||||
/* INCLUDES ******************************************************************/
|
||||
|
||||
#include <ndk/amd64/asm.h>
|
||||
#include <ndk/amd64/asmmacro.S>
|
||||
|
||||
.intel_syntax noprefix
|
||||
|
||||
|
||||
.proc log10
|
||||
UNIMPLEMENTED log10
|
||||
ret
|
||||
|
||||
.endproc
|
21
reactos/lib/sdk/crt/math/amd64/sin.S
Normal file
21
reactos/lib/sdk/crt/math/amd64/sin.S
Normal file
|
@ -0,0 +1,21 @@
|
|||
/*
|
||||
* COPYRIGHT: See COPYING in the top level directory
|
||||
* PROJECT: ReactOS system libraries
|
||||
* PURPOSE: Implementation of sin
|
||||
* FILE: lib/sdk/crt/math/amd64/sin.S
|
||||
* PROGRAMMER: Timo Kreuzer (timo.kreuzer@reactos.org)
|
||||
*/
|
||||
|
||||
/* INCLUDES ******************************************************************/
|
||||
|
||||
#include <ndk/amd64/asm.h>
|
||||
#include <ndk/amd64/asmmacro.S>
|
||||
|
||||
.intel_syntax noprefix
|
||||
|
||||
|
||||
.proc sin
|
||||
UNIMPLEMENTED sin
|
||||
ret
|
||||
|
||||
.endproc
|
21
reactos/lib/sdk/crt/math/amd64/sqrt.S
Normal file
21
reactos/lib/sdk/crt/math/amd64/sqrt.S
Normal file
|
@ -0,0 +1,21 @@
|
|||
/*
|
||||
* COPYRIGHT: See COPYING in the top level directory
|
||||
* PROJECT: ReactOS system libraries
|
||||
* PURPOSE: Implementation of sqrt
|
||||
* FILE: lib/sdk/crt/math/amd64/sqrt.S
|
||||
* PROGRAMMER: Timo Kreuzer (timo.kreuzer@reactos.org)
|
||||
*/
|
||||
|
||||
/* INCLUDES ******************************************************************/
|
||||
|
||||
#include <ndk/amd64/asm.h>
|
||||
#include <ndk/amd64/asmmacro.S>
|
||||
|
||||
.intel_syntax noprefix
|
||||
|
||||
|
||||
.proc sqrt
|
||||
UNIMPLEMENTED sqrt
|
||||
ret
|
||||
|
||||
.endproc
|
20
reactos/lib/sdk/crt/math/amd64/sqrtf.S
Normal file
20
reactos/lib/sdk/crt/math/amd64/sqrtf.S
Normal file
|
@ -0,0 +1,20 @@
|
|||
/*
|
||||
* COPYRIGHT: See COPYING in the top level directory
|
||||
* PROJECT: ReactOS system libraries
|
||||
* PURPOSE: Implementation of tan
|
||||
* FILE: lib/sdk/crt/math/amd64/sqrtf.S
|
||||
* PROGRAMMER: Timo Kreuzer (timo.kreuzer@reactos.org)
|
||||
*/
|
||||
|
||||
/* INCLUDES ******************************************************************/
|
||||
|
||||
#include <ndk/amd64/asm.h>
|
||||
#include <ndk/amd64/asmmacro.S>
|
||||
|
||||
.intel_syntax noprefix
|
||||
|
||||
|
||||
.proc sqrtf
|
||||
sqrtss xmm0, xmm0
|
||||
ret
|
||||
.endproc
|
21
reactos/lib/sdk/crt/math/amd64/tan.S
Normal file
21
reactos/lib/sdk/crt/math/amd64/tan.S
Normal file
|
@ -0,0 +1,21 @@
|
|||
/*
|
||||
* COPYRIGHT: See COPYING in the top level directory
|
||||
* PROJECT: ReactOS system libraries
|
||||
* PURPOSE: Implementation of tan
|
||||
* FILE: lib/sdk/crt/math/amd64/tan.S
|
||||
* PROGRAMMER: Timo Kreuzer (timo.kreuzer@reactos.org)
|
||||
*/
|
||||
|
||||
/* INCLUDES ******************************************************************/
|
||||
|
||||
#include <ndk/amd64/asm.h>
|
||||
#include <ndk/amd64/asmmacro.S>
|
||||
|
||||
.intel_syntax noprefix
|
||||
|
||||
|
||||
.proc tan
|
||||
UNIMPLEMENTED tan
|
||||
ret
|
||||
|
||||
.endproc
|
|
@ -1,27 +0,0 @@
|
|||
/**
|
||||
* This file has no copyright assigned and is placed in the Public Domain.
|
||||
* This file is part of the w64 mingw-runtime package.
|
||||
* No warranty is given; refer to the file DISCLAIMER.PD within this package.
|
||||
*/
|
||||
/*
|
||||
* Written by J.T. Conklin <jtc@netbsd.org>.
|
||||
* Public domain.
|
||||
*/
|
||||
|
||||
/* asin = atan (x / sqrt(1 - x^2)) */
|
||||
|
||||
float asinf (float x);
|
||||
|
||||
float asinf (float x)
|
||||
{
|
||||
float res = 0.0F;
|
||||
|
||||
asm ( "fld %%st\n\t"
|
||||
"fmul %%st(0)\n\t" /* x^2 */
|
||||
"fld1\n\t"
|
||||
"fsubp\n\t" /* 1 - x^2 */
|
||||
"fsqrt\n\t" /* sqrt (1 - x^2) */
|
||||
"fpatan"
|
||||
: "=t" (res) : "0" (x) : "st(1)");
|
||||
return res;
|
||||
}
|
|
@ -1,18 +0,0 @@
|
|||
/**
|
||||
* This file has no copyright assigned and is placed in the Public Domain.
|
||||
* This file is part of the w64 mingw-runtime package.
|
||||
* No warranty is given; refer to the file DISCLAIMER.PD within this package.
|
||||
*/
|
||||
#include <math.h>
|
||||
|
||||
double
|
||||
atan (double x)
|
||||
{
|
||||
double res = 0.0L;
|
||||
#if defined(__GNUC__)
|
||||
asm ("fld1\n\t"
|
||||
"fpatan"
|
||||
: "=t" (res) : "0" (x));
|
||||
#endif
|
||||
return res;
|
||||
}
|
|
@ -1,16 +0,0 @@
|
|||
/**
|
||||
* This file has no copyright assigned and is placed in the Public Domain.
|
||||
* This file is part of the w64 mingw-runtime package.
|
||||
* No warranty is given; refer to the file DISCLAIMER.PD within this package.
|
||||
*/
|
||||
#include <math.h>
|
||||
|
||||
double
|
||||
atan2 (double y, double x)
|
||||
{
|
||||
long double res = 0.0L;
|
||||
#ifdef __GNUC__
|
||||
asm ("fpatan" : "=t" (res) : "u" (y), "0" (x) : "st(1)");
|
||||
#endif
|
||||
return res;
|
||||
}
|
|
@ -1,22 +0,0 @@
|
|||
/**
|
||||
* This file has no copyright assigned and is placed in the Public Domain.
|
||||
* This file is part of the w64 mingw-runtime package.
|
||||
* No warranty is given; refer to the file DISCLAIMER.PD within this package.
|
||||
*/
|
||||
/*
|
||||
* Written by J.T. Conklin <jtc@netbsd.org>.
|
||||
* Public domain.
|
||||
*
|
||||
*/
|
||||
|
||||
#include <math.h>
|
||||
|
||||
float
|
||||
atan2f (float y, float x)
|
||||
{
|
||||
float res = 0.0F;
|
||||
#ifdef __GNUC__
|
||||
asm ("fpatan" : "=t" (res) : "u" (y), "0" (x) : "st(1)");
|
||||
#endif
|
||||
return res;
|
||||
}
|
|
@ -1,23 +0,0 @@
|
|||
/**
|
||||
* This file has no copyright assigned and is placed in the Public Domain.
|
||||
* This file is part of the w64 mingw-runtime package.
|
||||
* No warranty is given; refer to the file DISCLAIMER.PD within this package.
|
||||
*/
|
||||
/*
|
||||
* Written by J.T. Conklin <jtc@netbsd.org>.
|
||||
* Public domain.
|
||||
*
|
||||
*/
|
||||
|
||||
#include <math.h>
|
||||
|
||||
float
|
||||
atanf (float x)
|
||||
{
|
||||
float res = 0.0F;
|
||||
#ifdef __GNUC__
|
||||
asm ("fld1\n\t"
|
||||
"fpatan" : "=t" (res) : "0" (x));
|
||||
#endif
|
||||
return res;
|
||||
}
|
|
@ -1,21 +0,0 @@
|
|||
/**
|
||||
* This file has no copyright assigned and is placed in the Public Domain.
|
||||
* This file is part of the w64 mingw-runtime package.
|
||||
* No warranty is given; refer to the file DISCLAIMER.PD within this package.
|
||||
*/
|
||||
#include <math.h>
|
||||
|
||||
typedef union U
|
||||
{
|
||||
unsigned int u[2];
|
||||
double d;
|
||||
} U;
|
||||
|
||||
double copysign(double x, double y)
|
||||
{
|
||||
U h,j;
|
||||
h.d = x;
|
||||
j.d = y;
|
||||
h.u[1] = (h.u[1] & 0x7fffffff) | (j.u[1] & 0x80000000);
|
||||
return h.d;
|
||||
}
|
|
@ -1,19 +0,0 @@
|
|||
/**
|
||||
* This file has no copyright assigned and is placed in the Public Domain.
|
||||
* This file is part of the w64 mingw-runtime package.
|
||||
* No warranty is given; refer to the file DISCLAIMER.PD within this package.
|
||||
*/
|
||||
#include <math.h>
|
||||
|
||||
typedef union ui_f {
|
||||
float f;
|
||||
unsigned int ui;
|
||||
} ui_f;
|
||||
|
||||
float copysignf(float aX, float aY)
|
||||
{
|
||||
ui_f x,y;
|
||||
x.f=aX; y.f=aY;
|
||||
x.ui= (x.ui & 0x7fffffff) | (y.ui & 0x80000000);
|
||||
return x.f;
|
||||
}
|
|
@ -1,11 +0,0 @@
|
|||
/**
|
||||
* This file has no copyright assigned and is placed in the Public Domain.
|
||||
* This file is part of the w64 mingw-runtime package.
|
||||
* No warranty is given; refer to the file DISCLAIMER.PD within this package.
|
||||
*/
|
||||
#include <math.h>
|
||||
|
||||
float cosf(float _X)
|
||||
{
|
||||
return ((float)cos((double)_X));
|
||||
}
|
|
@ -1,55 +0,0 @@
|
|||
/**
|
||||
* This file has no copyright assigned and is placed in the Public Domain.
|
||||
* This file is part of the w64 mingw-runtime package.
|
||||
* No warranty is given; refer to the file DISCLAIMER.PD within this package.
|
||||
*/
|
||||
#include <math.h>
|
||||
#define MAXLOG 7.09782712893383996843E2
|
||||
#define MINLOG -7.08396418532264106224E2
|
||||
|
||||
static double c0 = 1.44268798828125L;
|
||||
static double c1 = 7.05260771340735992468e-6L;
|
||||
|
||||
static double
|
||||
__exp(double x)
|
||||
{
|
||||
double res = 0.0L;
|
||||
#ifdef __GNUC__
|
||||
asm ("fldl2e\n\t" /* 1 log2(e) */
|
||||
"fmul %%st(1),%%st\n\t" /* 1 x log2(e) */
|
||||
"frndint\n\t" /* 1 i */
|
||||
"fld %%st(1)\n\t" /* 2 x */
|
||||
"frndint\n\t" /* 2 xi */
|
||||
"fld %%st(1)\n\t" /* 3 i */
|
||||
"fldt %2\n\t" /* 4 c0 */
|
||||
"fld %%st(2)\n\t" /* 5 xi */
|
||||
"fmul %%st(1),%%st\n\t" /* 5 c0 xi */
|
||||
"fsubp %%st,%%st(2)\n\t" /* 4 f = c0 xi - i */
|
||||
"fld %%st(4)\n\t" /* 5 x */
|
||||
"fsub %%st(3),%%st\n\t" /* 5 xf = x - xi */
|
||||
"fmulp %%st,%%st(1)\n\t" /* 4 c0 xf */
|
||||
"faddp %%st,%%st(1)\n\t" /* 3 f = f + c0 xf */
|
||||
"fldt %3\n\t" /* 4 */
|
||||
"fmul %%st(4),%%st\n\t" /* 4 c1 * x */
|
||||
"faddp %%st,%%st(1)\n\t" /* 3 f = f + c1 * x */
|
||||
"f2xm1\n\t" /* 3 2^(fract(x * log2(e))) - 1 */
|
||||
"fld1\n\t" /* 4 1.0 */
|
||||
"faddp\n\t" /* 3 2^(fract(x * log2(e))) */
|
||||
"fstp %%st(1)\n\t" /* 2 */
|
||||
"fscale\n\t" /* 2 scale factor is st(1); e^x */
|
||||
"fstp %%st(1)\n\t" /* 1 */
|
||||
"fstp %%st(1)\n\t" /* 0 */
|
||||
: "=t" (res) : "0" (x), "m" (c0), "m" (c1) : "ax", "dx");
|
||||
#endif
|
||||
return res;
|
||||
}
|
||||
|
||||
double exp (double x)
|
||||
{
|
||||
if (x > MAXLOG)
|
||||
return INFINITY;
|
||||
else if (x < MINLOG)
|
||||
return 0.0L;
|
||||
else
|
||||
return __exp (x);
|
||||
}
|
|
@ -1,10 +0,0 @@
|
|||
/**
|
||||
* This file has no copyright assigned and is placed in the Public Domain.
|
||||
* This file is part of the w64 mingw-runtime package.
|
||||
* No warranty is given; refer to the file DISCLAIMER.PD within this package.
|
||||
*/
|
||||
#include <math.h>
|
||||
float expf (float x)
|
||||
{
|
||||
return (float) exp (x);
|
||||
}
|
|
@ -1,16 +0,0 @@
|
|||
/**
|
||||
* This file has no copyright assigned and is placed in the Public Domain.
|
||||
* This file is part of the w64 mingw-runtime package.
|
||||
* No warranty is given; refer to the file DISCLAIMER.PD within this package.
|
||||
*/
|
||||
#include <math.h>
|
||||
|
||||
double
|
||||
fabs (double x)
|
||||
{
|
||||
double res = 0.0;
|
||||
#ifdef __GNUC__
|
||||
asm ("fabs;" : "=t" (res) : "0" (x));
|
||||
#endif
|
||||
return res;
|
||||
}
|
|
@ -1,21 +0,0 @@
|
|||
/**
|
||||
* This file has no copyright assigned and is placed in the Public Domain.
|
||||
* This file is part of the w64 mingw-runtime package.
|
||||
* No warranty is given; refer to the file DISCLAIMER.PD within this package.
|
||||
*/
|
||||
#include <math.h>
|
||||
|
||||
double
|
||||
fmod (double x, double y)
|
||||
{
|
||||
double res = 0.0L;
|
||||
#ifdef __GNUC__
|
||||
asm ("1:\tfprem\n\t"
|
||||
"fstsw %%ax\n\t"
|
||||
"sahf\n\t"
|
||||
"jp 1b\n\t"
|
||||
"fstp %%st(1)"
|
||||
: "=t" (res) : "0" (x), "u" (y) : "ax", "st(1)");
|
||||
#endif
|
||||
return res;
|
||||
}
|
|
@ -1,29 +0,0 @@
|
|||
/**
|
||||
* This file has no copyright assigned and is placed in the Public Domain.
|
||||
* This file is part of the w64 mingw-runtime package.
|
||||
* No warranty is given; refer to the file DISCLAIMER.PD within this package.
|
||||
*/
|
||||
/*
|
||||
* Written by J.T. Conklin <jtc@netbsd.org>.
|
||||
* Public domain.
|
||||
*
|
||||
* Adapted for float type by Danny Smith
|
||||
* <dannysmith@users.sourceforge.net>.
|
||||
*/
|
||||
|
||||
#include <math.h>
|
||||
|
||||
float
|
||||
fmodf (float x, float y)
|
||||
{
|
||||
float res = 0.0F;
|
||||
#ifdef __GNUC__
|
||||
asm ("1:\tfprem\n\t"
|
||||
"fstsw %%ax\n\t"
|
||||
"sahf\n\t"
|
||||
"jp 1b\n\t"
|
||||
"fstp %%st(1)"
|
||||
: "=t" (res) : "0" (x), "u" (y) : "ax", "st(1)");
|
||||
#endif
|
||||
return res;
|
||||
}
|
|
@ -1,12 +0,0 @@
|
|||
/**
|
||||
* This file has no copyright assigned and is placed in the Public Domain.
|
||||
* This file is part of the w64 mingw-runtime package.
|
||||
* No warranty is given; refer to the file DISCLAIMER.PD within this package.
|
||||
*/
|
||||
#include <math.h>
|
||||
|
||||
float hypotf (float x, float y)
|
||||
{
|
||||
return (float) _hypot (x, y);
|
||||
}
|
||||
|
50
reactos/lib/sdk/crt/math/i386/atan_asm.s
Normal file
50
reactos/lib/sdk/crt/math/i386/atan_asm.s
Normal file
|
@ -0,0 +1,50 @@
|
|||
/*
|
||||
* COPYRIGHT: See COPYING in the top level directory
|
||||
* PROJECT: ReactOS kernel
|
||||
* PURPOSE: Run-Time Library
|
||||
* FILE: lib/rtl/i386/atan.S
|
||||
* PROGRAMER: Alex Ionescu (alex@relsoft.net)
|
||||
*
|
||||
* Copyright (C) 2002 Michael Ringgaard.
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
*
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* 3. Neither the name of the project nor the names of its contributors
|
||||
* may be used to endorse or promote products derived from this software
|
||||
* without specific prior written permission.
|
||||
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
||||
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE
|
||||
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
||||
* OR SERVICES// LOSS OF USE, DATA, OR PROFITS// OR BUSINESS INTERRUPTION)
|
||||
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
.globl _atan
|
||||
|
||||
.intel_syntax noprefix
|
||||
|
||||
/* FUNCTIONS ***************************************************************/
|
||||
|
||||
_atan:
|
||||
push ebp
|
||||
mov ebp,esp
|
||||
fld qword ptr [ebp+8] // Load real from stack
|
||||
fld1 // Load constant 1
|
||||
fpatan // Take the arctangent
|
||||
pop ebp
|
||||
ret
|
|
@ -1,54 +0,0 @@
|
|||
/**
|
||||
* This file has no copyright assigned and is placed in the Public Domain.
|
||||
* This file is part of the w64 mingw-runtime package.
|
||||
* No warranty is given; refer to the file DISCLAIMER.PD within this package.
|
||||
*/
|
||||
|
||||
.file "ceil.S"
|
||||
.text
|
||||
#ifdef _WIN64
|
||||
.align 8
|
||||
#else
|
||||
.align 4
|
||||
#endif
|
||||
.globl _ceil
|
||||
.def _ceil; .scl 2; .type 32; .endef
|
||||
_ceil:
|
||||
#ifdef _WIN64
|
||||
fldt (%rdx)
|
||||
subq $24,%rsp
|
||||
|
||||
fstcw 8(%rsp) /* store fpu control word */
|
||||
|
||||
/* We use here %edx although only the low 1 bits are defined.
|
||||
But none of the operations should care and they are faster
|
||||
than the 16 bit operations. */
|
||||
movl $0x0800,%edx /* round towards +oo */
|
||||
orl 8(%rsp),%edx
|
||||
andl $0xfbff,%edx
|
||||
movl %edx,(%rsp)
|
||||
fldcw (%rsp) /* load modified control word */
|
||||
|
||||
frndint /* round */
|
||||
|
||||
fldcw 8(%rsp) /* restore original control word */
|
||||
|
||||
addq $24,%rsp
|
||||
movq %rcx,%rax
|
||||
movq $0,8(%rcx)
|
||||
fstpt (%rcx)
|
||||
ret
|
||||
#else
|
||||
fldt 4(%esp)
|
||||
subl $8,%esp
|
||||
fstcw 4(%esp)
|
||||
movl $0x0800,%edx
|
||||
orl 4(%esp),%edx
|
||||
andl $0xfbff,%edx
|
||||
movl %edx,(%esp)
|
||||
fldcw (%esp)
|
||||
frndint
|
||||
fldcw 4(%esp)
|
||||
addl $8,%esp
|
||||
ret
|
||||
#endif
|
57
reactos/lib/sdk/crt/math/i386/ceil_asm.s
Normal file
57
reactos/lib/sdk/crt/math/i386/ceil_asm.s
Normal file
|
@ -0,0 +1,57 @@
|
|||
/*
|
||||
* COPYRIGHT: See COPYING in the top level directory
|
||||
* PROJECT: ReactOS kernel
|
||||
* PURPOSE: Run-Time Library
|
||||
* FILE: lib/rtl/i386/ceil.S
|
||||
* PROGRAMER: Alex Ionescu (alex@relsoft.net)
|
||||
*
|
||||
* Copyright (C) 2002 Michael Ringgaard.
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
*
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* 3. Neither the name of the project nor the names of its contributors
|
||||
* may be used to endorse or promote products derived from this software
|
||||
* without specific prior written permission.
|
||||
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
||||
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE
|
||||
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
||||
* OR SERVICES// LOSS OF USE, DATA, OR PROFITS// OR BUSINESS INTERRUPTION)
|
||||
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
.globl _ceil
|
||||
|
||||
.intel_syntax noprefix
|
||||
|
||||
/* FUNCTIONS ***************************************************************/
|
||||
|
||||
_ceil:
|
||||
push ebp
|
||||
mov ebp,esp
|
||||
sub esp,4 // Allocate temporary space
|
||||
fld qword ptr [ebp+8] // Load real from stack
|
||||
fstcw [ebp-2] // Save control word
|
||||
fclex // Clear exceptions
|
||||
mov word ptr [ebp-4],0xb63 // Rounding control word
|
||||
fldcw [ebp-4] // Set new rounding control
|
||||
frndint // Round to integer
|
||||
fclex // Clear exceptions
|
||||
fldcw [ebp-2] // Restore control word
|
||||
mov esp,ebp // Deallocate temporary space
|
||||
pop ebp
|
||||
ret
|
|
@ -1,54 +0,0 @@
|
|||
/**
|
||||
* This file has no copyright assigned and is placed in the Public Domain.
|
||||
* This file is part of the w64 mingw-runtime package.
|
||||
* No warranty is given; refer to the file DISCLAIMER.PD within this package.
|
||||
*/
|
||||
|
||||
.file "ceilf.S"
|
||||
.text
|
||||
.align 4
|
||||
.globl _ceilf
|
||||
.def _ceilf; .scl 2; .type 32; .endef
|
||||
_ceilf:
|
||||
#ifdef _WIN64
|
||||
subq $24,%rsp
|
||||
movss %xmm0,8(%rsp)
|
||||
flds 8(%rsp)
|
||||
|
||||
fstcw 4(%rsp) /* store fpu control word */
|
||||
|
||||
movl $0x0800,%edx /* round towards +oo */
|
||||
orl 4(%rsp),%edx
|
||||
andl $0xfbff,%edx
|
||||
movl %edx,(%rsp)
|
||||
fldcw (%rsp) /* load modified control word */
|
||||
|
||||
frndint /* round */
|
||||
|
||||
fldcw 4(%rsp) /* restore original control word */
|
||||
fstps 8(%rsp)
|
||||
movss 8(%rsp),%xmm0
|
||||
addq $24,%rsp
|
||||
ret
|
||||
#else
|
||||
flds 4(%esp)
|
||||
subl $8,%esp
|
||||
|
||||
fstcw 4(%esp) /* store fpu control word */
|
||||
|
||||
/* We use here %edx although only the low 1 bits are defined.
|
||||
But none of the operations should care and they are faster
|
||||
than the 16 bit operations. */
|
||||
movl $0x0800,%edx /* round towards +oo */
|
||||
orl 4(%esp),%edx
|
||||
andl $0xfbff,%edx
|
||||
movl %edx,(%esp)
|
||||
fldcw (%esp) /* load modified control word */
|
||||
|
||||
frndint /* round */
|
||||
|
||||
fldcw 4(%esp) /* restore original control word */
|
||||
|
||||
addl $8,%esp
|
||||
ret
|
||||
#endif
|
|
@ -1,53 +0,0 @@
|
|||
/**
|
||||
* This file has no copyright assigned and is placed in the Public Domain.
|
||||
* This file is part of the w64 mingw-runtime package.
|
||||
* No warranty is given; refer to the file DISCLAIMER.PD within this package.
|
||||
*/
|
||||
.file "cos.S"
|
||||
.text
|
||||
#ifdef _WIN64
|
||||
.align 8
|
||||
#else
|
||||
.align 4
|
||||
#endif
|
||||
.globl _cos
|
||||
.def _cos; .scl 2; .type 32; .endef
|
||||
_cos:
|
||||
#ifdef _WIN64
|
||||
fldt (%rdx)
|
||||
fcos
|
||||
fnstsw %ax
|
||||
testl $0x400,%eax
|
||||
jz 1f
|
||||
fldpi
|
||||
fadd %st(0)
|
||||
fxch %st(1)
|
||||
2: fprem1
|
||||
fnstsw %ax
|
||||
testl $0x400,%eax
|
||||
jnz 2b
|
||||
fstp %st(1)
|
||||
fcos
|
||||
1: movq %rcx,%rax
|
||||
movq $0,8(%rcx)
|
||||
fstpt (%rcx)
|
||||
ret
|
||||
#else
|
||||
fldt 4(%esp)
|
||||
fcos
|
||||
fnstsw %ax
|
||||
testl $0x400,%eax
|
||||
jnz 1f
|
||||
ret
|
||||
1: fldpi
|
||||
fadd %st(0)
|
||||
fxch %st(1)
|
||||
2: fprem1
|
||||
fnstsw %ax
|
||||
testl $0x400,%eax
|
||||
jnz 2b
|
||||
fstp %st(1)
|
||||
fcos
|
||||
ret
|
||||
#endif
|
||||
|
49
reactos/lib/sdk/crt/math/i386/cos_asm.s
Normal file
49
reactos/lib/sdk/crt/math/i386/cos_asm.s
Normal file
|
@ -0,0 +1,49 @@
|
|||
/*
|
||||
* COPYRIGHT: See COPYING in the top level directory
|
||||
* PROJECT: ReactOS kernel
|
||||
* PURPOSE: Run-Time Library
|
||||
* FILE: lib/rtl/i386/cos.S
|
||||
* PROGRAMER: Alex Ionescu (alex@relsoft.net)
|
||||
*
|
||||
* Copyright (C) 2002 Michael Ringgaard.
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
*
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* 3. Neither the name of the project nor the names of its contributors
|
||||
* may be used to endorse or promote products derived from this software
|
||||
* without specific prior written permission.
|
||||
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
||||
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE
|
||||
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
||||
* OR SERVICES// LOSS OF USE, DATA, OR PROFITS// OR BUSINESS INTERRUPTION)
|
||||
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
.globl _cos
|
||||
|
||||
.intel_syntax noprefix
|
||||
|
||||
/* FUNCTIONS ***************************************************************/
|
||||
|
||||
_cos:
|
||||
push ebp
|
||||
mov ebp,esp // Point to the stack frame
|
||||
fld qword ptr [ebp+8] // Load real from stack
|
||||
fcos // Take the cosine
|
||||
pop ebp
|
||||
ret
|
49
reactos/lib/sdk/crt/math/i386/fabs_asm.s
Normal file
49
reactos/lib/sdk/crt/math/i386/fabs_asm.s
Normal file
|
@ -0,0 +1,49 @@
|
|||
/*
|
||||
* COPYRIGHT: See COPYING in the top level directory
|
||||
* PROJECT: ReactOS kernel
|
||||
* PURPOSE: Run-Time Library
|
||||
* FILE: lib/rtl/i386/fabs.S
|
||||
* PROGRAMER: Alex Ionescu (alex@relsoft.net)
|
||||
*
|
||||
* Copyright (C) 2002 Michael Ringgaard.
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
*
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* 3. Neither the name of the project nor the names of its contributors
|
||||
* may be used to endorse or promote products derived from this software
|
||||
* without specific prior written permission.
|
||||
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
||||
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE
|
||||
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
||||
* OR SERVICES// LOSS OF USE, DATA, OR PROFITS// OR BUSINESS INTERRUPTION)
|
||||
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
.globl _fabs
|
||||
|
||||
.intel_syntax noprefix
|
||||
|
||||
/* FUNCTIONS ***************************************************************/
|
||||
|
||||
_fabs:
|
||||
push ebp
|
||||
mov ebp,esp
|
||||
fld qword ptr [ebp+8] // Load real from stack
|
||||
fabs // Take the absolute value
|
||||
pop ebp
|
||||
ret
|
|
@ -1,62 +0,0 @@
|
|||
/**
|
||||
* This file has no copyright assigned and is placed in the Public Domain.
|
||||
* This file is part of the w64 mingw-runtime package.
|
||||
* No warranty is given; refer to the file DISCLAIMER.PD within this package.
|
||||
*/
|
||||
|
||||
.file "floor.S"
|
||||
.text
|
||||
#ifdef _WIN64
|
||||
.align 8
|
||||
#else
|
||||
.align 4
|
||||
#endif
|
||||
.globl _floor
|
||||
.def _floor; .scl 2; .type 32; .endef
|
||||
_floor:
|
||||
#ifdef _WIN64
|
||||
fldt (%rdx)
|
||||
subq $24,%rsp
|
||||
|
||||
fstcw 8(%rsp) /* store fpu control word */
|
||||
|
||||
/* We use here %edx although only the low 1 bits are defined.
|
||||
But none of the operations should care and they are faster
|
||||
than the 16 bit operations. */
|
||||
movl $0x400,%edx /* round towards -oo */
|
||||
orl 8(%rsp),%edx
|
||||
andl $0xf7ff,%edx
|
||||
movl %edx,(%rsp)
|
||||
fldcw (%rsp) /* load modified control word */
|
||||
|
||||
frndint /* round */
|
||||
|
||||
fldcw 8(%rsp) /* restore original control word */
|
||||
|
||||
addq $24,%rsp
|
||||
movq %rcx,%rax
|
||||
movq $0,8(%rcx)
|
||||
fstpt (%rcx)
|
||||
ret
|
||||
#else
|
||||
fldt 4(%esp)
|
||||
subl $8,%esp
|
||||
|
||||
fstcw 4(%esp) /* store fpu control word */
|
||||
|
||||
/* We use here %edx although only the low 1 bits are defined.
|
||||
But none of the operations should care and they are faster
|
||||
than the 16 bit operations. */
|
||||
movl $0x400,%edx /* round towards -oo */
|
||||
orl 4(%esp),%edx
|
||||
andl $0xf7ff,%edx
|
||||
movl %edx,(%esp)
|
||||
fldcw (%esp) /* load modified control word */
|
||||
|
||||
frndint /* round */
|
||||
|
||||
fldcw 4(%esp) /* restore original control word */
|
||||
|
||||
addl $8,%esp
|
||||
ret
|
||||
#endif
|
|
@ -1,61 +0,0 @@
|
|||
/*
|
||||
* Written by J.T. Conklin <jtc@netbsd.org>.
|
||||
* Public domain.
|
||||
*
|
||||
* Changes for long double by Ulrich Drepper <drepper@cygnus.com>
|
||||
*
|
||||
* Removed header file dependency for use in libmingwex.a by
|
||||
* Danny Smith <dannysmith@users.sourceforge.net>
|
||||
*/
|
||||
.file "floorf.S"
|
||||
.text
|
||||
#ifdef _WIN64
|
||||
.align 8
|
||||
#else
|
||||
.align 4
|
||||
#endif
|
||||
.globl _floorf
|
||||
.def _floorf; .scl 2; .type 32; .endef
|
||||
_floorf:
|
||||
#ifdef _WIN64
|
||||
subq $24,%rsp
|
||||
movss %xmm0,8(%rsp)
|
||||
flds 8(%rsp)
|
||||
|
||||
fstcw 4(%rsp) /* store fpu control word */
|
||||
movl $0x400,%edx /* round towards -oo */
|
||||
orl 4(%rsp),%edx
|
||||
andl $0xf7ff,%edx
|
||||
movl %edx,(%rsp)
|
||||
fldcw (%rsp) /* load modified control word */
|
||||
|
||||
frndint /* round */
|
||||
|
||||
fldcw 4(%rsp) /* restore original control word */
|
||||
|
||||
fstps 8(%rsp)
|
||||
movss 8(%rsp),%xmm0
|
||||
addq $24,%rsp
|
||||
ret
|
||||
#else
|
||||
flds 4(%esp)
|
||||
subl $8,%esp
|
||||
|
||||
fstcw 4(%esp) /* store fpu control word */
|
||||
|
||||
/* We use here %edx although only the low 1 bits are defined.
|
||||
But none of the operations should care and they are faster
|
||||
than the 16 bit operations. */
|
||||
movl $0x400,%edx /* round towards -oo */
|
||||
orl 4(%esp),%edx
|
||||
andl $0xf7ff,%edx
|
||||
movl %edx,(%esp)
|
||||
fldcw (%esp) /* load modified control word */
|
||||
|
||||
frndint /* round */
|
||||
|
||||
fldcw 4(%esp) /* restore original control word */
|
||||
|
||||
addl $8,%esp
|
||||
ret
|
||||
#endif
|
|
@ -1,65 +0,0 @@
|
|||
/**
|
||||
* This file has no copyright assigned and is placed in the Public Domain.
|
||||
* This file is part of the w64 mingw-runtime package.
|
||||
* No warranty is given; refer to the file DISCLAIMER.PD within this package.
|
||||
*/
|
||||
|
||||
.file "log.S"
|
||||
.text
|
||||
#ifdef _WIN64
|
||||
.align 8
|
||||
#else
|
||||
.align 4
|
||||
#endif
|
||||
one: .double 1.0
|
||||
/* It is not important that this constant is precise. It is only
|
||||
a value which is known to be on the safe side for using the
|
||||
fyl2xp1 instruction. */
|
||||
limit: .double 0.29
|
||||
|
||||
.globl _log
|
||||
.def _log; .scl 2; .type 32; .endef
|
||||
_log:
|
||||
#ifdef _WIN64
|
||||
fldln2 // log(2)
|
||||
fldt (%rdx) // x : log(2)
|
||||
fld %st // x : x : log(2)
|
||||
fsubl one // x-1 : x : log(2)
|
||||
fld %st // x-1 : x-1 : x : log(2)
|
||||
fabs // |x-1| : x-1 : x : log(2)
|
||||
fcompl limit // x-1 : x : log(2)
|
||||
fnstsw // x-1 : x : log(2)
|
||||
andb $0x45, %ah
|
||||
jz 2f
|
||||
fstp %st(1) // x-1 : log(2)
|
||||
fyl2xp1 // log(x)
|
||||
movq %rcx,%rax
|
||||
movq $0,8(%rcx)
|
||||
fstpt (%rcx)
|
||||
ret
|
||||
|
||||
2: fstp %st(0) // x : log(2)
|
||||
fyl2x // log(x)
|
||||
movq %rcx,%rax
|
||||
movq $0,8(%rcx)
|
||||
fstpt (%rcx)
|
||||
ret
|
||||
#else
|
||||
fldln2 // log(2)
|
||||
fldt 4(%esp) // x : log(2)
|
||||
fld %st // x : x : log(2)
|
||||
fsubl one // x-1 : x : log(2)
|
||||
fld %st // x-1 : x-1 : x : log(2)
|
||||
fabs // |x-1| : x-1 : x : log(2)
|
||||
fcompl limit // x-1 : x : log(2)
|
||||
fnstsw // x-1 : x : log(2)
|
||||
andb $0x45, %ah
|
||||
jz 2f
|
||||
fstp %st(1) // x-1 : log(2)
|
||||
fyl2xp1 // log(x)
|
||||
ret
|
||||
|
||||
2: fstp %st(0) // x : log(2)
|
||||
fyl2x // log(x)
|
||||
ret
|
||||
#endif
|
|
@ -1,92 +0,0 @@
|
|||
/**
|
||||
* This file has no copyright assigned and is placed in the Public Domain.
|
||||
* This file is part of the w64 mingw-runtime package.
|
||||
* No warranty is given; refer to the file DISCLAIMER.PD within this package.
|
||||
*/
|
||||
|
||||
.file "log10.S"
|
||||
.text
|
||||
#ifdef _WIN64
|
||||
.align 8
|
||||
#else
|
||||
.align 4
|
||||
#endif
|
||||
one: .double 1.0
|
||||
/* It is not important that this constant is precise. It is only
|
||||
a value which is known to be on the safe side for using the
|
||||
fyl2xp1 instruction. */
|
||||
limit: .double 0.29
|
||||
|
||||
.text
|
||||
#ifdef _WIN64
|
||||
.align 8
|
||||
#else
|
||||
.align 4
|
||||
#endif
|
||||
.globl _log10
|
||||
.def _log10; .scl 2; .type 32; .endef
|
||||
_log10:
|
||||
#ifdef _WIN64
|
||||
fldlg2 // log10(2)
|
||||
fldt (%rdx) // x : log10(2)
|
||||
fxam
|
||||
fnstsw
|
||||
fld %st // x : x : log10(2)
|
||||
sahf
|
||||
jc 3f // in case x is NaN or ±Inf
|
||||
4: fsubl one // x-1 : x : log10(2)
|
||||
fld %st // x-1 : x-1 : x : log10(2)
|
||||
fabs // |x-1| : x-1 : x : log10(2)
|
||||
fcompl limit // x-1 : x : log10(2)
|
||||
fnstsw // x-1 : x : log10(2)
|
||||
andb $0x45, %ah
|
||||
jz 2f
|
||||
fstp %st(1) // x-1 : log10(2)
|
||||
fyl2xp1 // log10(x)
|
||||
movq %rcx,%rax
|
||||
movq $0,8(%rcx)
|
||||
fstpt (%rcx)
|
||||
ret
|
||||
|
||||
2: fstp %st(0) // x : log10(2)
|
||||
fyl2x // log10(x)
|
||||
movq %rcx,%rax
|
||||
movq $0,8(%rcx)
|
||||
fstpt (%rcx)
|
||||
ret
|
||||
|
||||
3: jp 4b // in case x is ±Inf
|
||||
fstp %st(1)
|
||||
fstp %st(1)
|
||||
movq %rcx,%rax
|
||||
movq $0,8(%rcx)
|
||||
fstpt (%rcx)
|
||||
ret
|
||||
#else
|
||||
fldlg2 // log10(2)
|
||||
fldt 4(%esp) // x : log10(2)
|
||||
fxam
|
||||
fnstsw
|
||||
fld %st // x : x : log10(2)
|
||||
sahf
|
||||
jc 3f // in case x is NaN or ±Inf
|
||||
4: fsubl one // x-1 : x : log10(2)
|
||||
fld %st // x-1 : x-1 : x : log10(2)
|
||||
fabs // |x-1| : x-1 : x : log10(2)
|
||||
fcompl limit // x-1 : x : log10(2)
|
||||
fnstsw // x-1 : x : log10(2)
|
||||
andb $0x45, %ah
|
||||
jz 2f
|
||||
fstp %st(1) // x-1 : log10(2)
|
||||
fyl2xp1 // log10(x)
|
||||
ret
|
||||
|
||||
2: fstp %st(0) // x : log10(2)
|
||||
fyl2x // log10(x)
|
||||
ret
|
||||
|
||||
3: jp 4b // in case x is ±Inf
|
||||
fstp %st(1)
|
||||
fstp %st(1)
|
||||
ret
|
||||
#endif
|
27
reactos/lib/sdk/crt/math/i386/log10_asm.s
Normal file
27
reactos/lib/sdk/crt/math/i386/log10_asm.s
Normal file
|
@ -0,0 +1,27 @@
|
|||
|
||||
/*
|
||||
* COPYRIGHT: See COPYING in the top level directory
|
||||
* PROJECT: ReactOS kernel
|
||||
* PURPOSE:
|
||||
* FILE:
|
||||
* PROGRAMER: Magnus Olsen (magnus@greatlord.com)
|
||||
*
|
||||
*/
|
||||
|
||||
.globl _log10
|
||||
|
||||
.intel_syntax noprefix
|
||||
|
||||
/* FUNCTIONS ***************************************************************/
|
||||
|
||||
_log10:
|
||||
|
||||
push ebp
|
||||
mov ebp,esp
|
||||
fld qword ptr [ebp+8] // Load real from stack
|
||||
fldlg2 // Load log base 10 of 2
|
||||
fxch st(1) // Exchange st, st(1)
|
||||
fyl2x // Compute the log base 10(x)
|
||||
pop ebp
|
||||
ret
|
||||
|
51
reactos/lib/sdk/crt/math/i386/log_asm.s
Normal file
51
reactos/lib/sdk/crt/math/i386/log_asm.s
Normal file
|
@ -0,0 +1,51 @@
|
|||
/*
|
||||
* COPYRIGHT: See COPYING in the top level directory
|
||||
* PROJECT: ReactOS kernel
|
||||
* PURPOSE: Run-Time Library
|
||||
* FILE: lib/rtl/i386/log.S
|
||||
* PROGRAMER: Alex Ionescu (alex@relsoft.net)
|
||||
*
|
||||
* Copyright (C) 2002 Michael Ringgaard.
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
*
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* 3. Neither the name of the project nor the names of its contributors
|
||||
* may be used to endorse or promote products derived from this software
|
||||
* without specific prior written permission.
|
||||
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
||||
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE
|
||||
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
||||
* OR SERVICES// LOSS OF USE, DATA, OR PROFITS// OR BUSINESS INTERRUPTION)
|
||||
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
.globl _log
|
||||
|
||||
.intel_syntax noprefix
|
||||
|
||||
/* FUNCTIONS ***************************************************************/
|
||||
|
||||
_log:
|
||||
push ebp
|
||||
mov ebp,esp
|
||||
fld qword ptr [ebp+8] // Load real from stack
|
||||
fldln2 // Load log base e of 2
|
||||
fxch st(1) // Exchange st, st(1)
|
||||
fyl2x // Compute the natural log(x)
|
||||
pop ebp
|
||||
ret
|
|
@ -1,57 +0,0 @@
|
|||
/**
|
||||
* This file has no copyright assigned and is placed in the Public Domain.
|
||||
* This file is part of the w64 mingw-runtime package.
|
||||
* No warranty is given; refer to the file DISCLAIMER.PD within this package.
|
||||
*/
|
||||
|
||||
.file "sin.S"
|
||||
.text
|
||||
#ifdef _WIN64
|
||||
.align 8
|
||||
#else
|
||||
.align 4
|
||||
#endif
|
||||
.globl _sin
|
||||
.def _sin; .scl 2; .type 32; .endef
|
||||
_sin:
|
||||
#ifdef _WIN64
|
||||
fldt (%rdx)
|
||||
fsin
|
||||
fnstsw %ax
|
||||
testl $0x400,%eax
|
||||
jnz 1f
|
||||
movq %rcx,%rax
|
||||
movq $0,8(%rcx)
|
||||
fstpt (%rcx)
|
||||
ret
|
||||
1: fldpi
|
||||
fadd %st(0)
|
||||
fxch %st(1)
|
||||
2: fprem1
|
||||
fnstsw %ax
|
||||
testl $0x400,%eax
|
||||
jnz 2b
|
||||
fstp %st(1)
|
||||
fsin
|
||||
movq %rcx,%rax
|
||||
movq $0,8(%rcx)
|
||||
fstpt (%rcx)
|
||||
ret
|
||||
#else
|
||||
fldt 4(%esp)
|
||||
fsin
|
||||
fnstsw %ax
|
||||
testl $0x400,%eax
|
||||
jnz 1f
|
||||
ret
|
||||
1: fldpi
|
||||
fadd %st(0)
|
||||
fxch %st(1)
|
||||
2: fprem1
|
||||
fnstsw %ax
|
||||
testl $0x400,%eax
|
||||
jnz 2b
|
||||
fstp %st(1)
|
||||
fsin
|
||||
ret
|
||||
#endif
|
49
reactos/lib/sdk/crt/math/i386/sin_asm.s
Normal file
49
reactos/lib/sdk/crt/math/i386/sin_asm.s
Normal file
|
@ -0,0 +1,49 @@
|
|||
/*
|
||||
* COPYRIGHT: See COPYING in the top level directory
|
||||
* PROJECT: ReactOS kernel
|
||||
* PURPOSE: Run-Time Library
|
||||
* FILE: lib/rtl/i386/sin.S
|
||||
* PROGRAMER: Alex Ionescu (alex@relsoft.net)
|
||||
*
|
||||
* Copyright (C) 2002 Michael Ringgaard.
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
*
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* 3. Neither the name of the project nor the names of its contributors
|
||||
* may be used to endorse or promote products derived from this software
|
||||
* without specific prior written permission.
|
||||
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
||||
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE
|
||||
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
||||
* OR SERVICES// LOSS OF USE, DATA, OR PROFITS// OR BUSINESS INTERRUPTION)
|
||||
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
.globl _sin
|
||||
|
||||
.intel_syntax noprefix
|
||||
|
||||
/* FUNCTIONS ***************************************************************/
|
||||
|
||||
_sin:
|
||||
push ebp // Save register bp
|
||||
mov ebp,esp // Point to the stack frame
|
||||
fld qword ptr [ebp+8] // Load real from stack
|
||||
fsin // Take the sine
|
||||
pop ebp // Restore register bp
|
||||
ret
|
49
reactos/lib/sdk/crt/math/i386/sqrt_asm.s
Normal file
49
reactos/lib/sdk/crt/math/i386/sqrt_asm.s
Normal file
|
@ -0,0 +1,49 @@
|
|||
/*
|
||||
* COPYRIGHT: See COPYING in the top level directory
|
||||
* PROJECT: ReactOS kernel
|
||||
* PURPOSE: Run-Time Library
|
||||
* FILE: lib/rtl/i386/sqrt.S
|
||||
* PROGRAMER: Alex Ionescu (alex@relsoft.net)
|
||||
*
|
||||
* Copyright (C) 2002 Michael Ringgaard.
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
*
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* 3. Neither the name of the project nor the names of its contributors
|
||||
* may be used to endorse or promote products derived from this software
|
||||
* without specific prior written permission.
|
||||
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
||||
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE
|
||||
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
||||
* OR SERVICES// LOSS OF USE, DATA, OR PROFITS// OR BUSINESS INTERRUPTION)
|
||||
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
.globl _sqrt
|
||||
|
||||
.intel_syntax noprefix
|
||||
|
||||
/* FUNCTIONS ***************************************************************/
|
||||
|
||||
_sqrt:
|
||||
push ebp
|
||||
mov ebp,esp
|
||||
fld qword ptr [ebp+8] // Load real from stack
|
||||
fsqrt // Take the square root
|
||||
pop ebp
|
||||
ret
|
|
@ -1,61 +0,0 @@
|
|||
/**
|
||||
* This file has no copyright assigned and is placed in the Public Domain.
|
||||
* This file is part of the w64 mingw-runtime package.
|
||||
* No warranty is given; refer to the file DISCLAIMER.PD within this package.
|
||||
*/
|
||||
|
||||
.file "tan.S"
|
||||
.text
|
||||
#ifdef _WIN64
|
||||
.align 8
|
||||
#else
|
||||
.align 4
|
||||
#endif
|
||||
.globl _tan
|
||||
.def _tan; .scl 2; .type 32; .endef
|
||||
_tan:
|
||||
#ifdef _WIN64
|
||||
fldt (%rdx)
|
||||
fptan
|
||||
fnstsw %ax
|
||||
testl $0x400,%eax
|
||||
jnz 1f
|
||||
fstp %st(0)
|
||||
movq %rcx,%rax
|
||||
movq $0,8(%rcx)
|
||||
fstpt (%rcx)
|
||||
ret
|
||||
1: fldpi
|
||||
fadd %st(0)
|
||||
fxch %st(1)
|
||||
2: fprem1
|
||||
fstsw %ax
|
||||
testl $0x400,%eax
|
||||
jnz 2b
|
||||
fstp %st(1)
|
||||
fptan
|
||||
fstp %st(0)
|
||||
movq %rcx,%rax
|
||||
movq $0,8(%rcx)
|
||||
fstpt (%rcx)
|
||||
ret
|
||||
#else
|
||||
fldt 4(%esp)
|
||||
fptan
|
||||
fnstsw %ax
|
||||
testl $0x400,%eax
|
||||
jnz 1f
|
||||
fstp %st(0)
|
||||
ret
|
||||
1: fldpi
|
||||
fadd %st(0)
|
||||
fxch %st(1)
|
||||
2: fprem1
|
||||
fstsw %ax
|
||||
testl $0x400,%eax
|
||||
jnz 2b
|
||||
fstp %st(1)
|
||||
fptan
|
||||
fstp %st(0)
|
||||
ret
|
||||
#endif
|
52
reactos/lib/sdk/crt/math/i386/tan_asm.s
Normal file
52
reactos/lib/sdk/crt/math/i386/tan_asm.s
Normal file
|
@ -0,0 +1,52 @@
|
|||
/*
|
||||
* COPYRIGHT: See COPYING in the top level directory
|
||||
* PROJECT: ReactOS kernel
|
||||
* PURPOSE: Run-Time Library
|
||||
* FILE: lib/rtl/i386/tan.S
|
||||
* PROGRAMER: Alex Ionescu (alex@relsoft.net)
|
||||
*
|
||||
* Copyright (C) 2002 Michael Ringgaard.
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
*
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* 3. Neither the name of the project nor the names of its contributors
|
||||
* may be used to endorse or promote products derived from this software
|
||||
* without specific prior written permission.
|
||||
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
||||
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE
|
||||
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
||||
* OR SERVICES// LOSS OF USE, DATA, OR PROFITS// OR BUSINESS INTERRUPTION)
|
||||
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
.globl _tan
|
||||
|
||||
.intel_syntax noprefix
|
||||
|
||||
/* FUNCTIONS ***************************************************************/
|
||||
|
||||
_tan:
|
||||
push ebp
|
||||
mov ebp,esp
|
||||
sub esp,4 // Allocate temporary space
|
||||
fld qword ptr [ebp+8] // Load real from stack
|
||||
fptan // Take the tangent
|
||||
fstp dword ptr [ebp-4] // Throw away the constant 1
|
||||
mov esp,ebp // Deallocate temporary space
|
||||
pop ebp
|
||||
ret
|
30
reactos/lib/sdk/crt/math/j0_y0.c
Normal file
30
reactos/lib/sdk/crt/math/j0_y0.c
Normal file
|
@ -0,0 +1,30 @@
|
|||
#include <math.h>
|
||||
|
||||
typedef int fpclass_t;
|
||||
fpclass_t _fpclass(double __d);
|
||||
int *_errno(void);
|
||||
|
||||
/*
|
||||
* @unimplemented
|
||||
*/
|
||||
double _j0(double num)
|
||||
{
|
||||
/* FIXME: errno handling */
|
||||
return j0(num);
|
||||
}
|
||||
|
||||
/*
|
||||
* @implemented
|
||||
*/
|
||||
double _y0(double num)
|
||||
{
|
||||
double retval;
|
||||
if (!isfinite(num)) *_errno() = EDOM;
|
||||
retval = y0(num);
|
||||
if (_fpclass(retval) == _FPCLASS_NINF)
|
||||
{
|
||||
*_errno() = EDOM;
|
||||
retval = sqrt(-1);
|
||||
}
|
||||
return retval;
|
||||
}
|
30
reactos/lib/sdk/crt/math/j1_y1.c
Normal file
30
reactos/lib/sdk/crt/math/j1_y1.c
Normal file
|
@ -0,0 +1,30 @@
|
|||
#include <math.h>
|
||||
|
||||
typedef int fpclass_t;
|
||||
fpclass_t _fpclass(double __d);
|
||||
int *_errno(void);
|
||||
|
||||
/*
|
||||
* @unimplemented
|
||||
*/
|
||||
double _j1(double num)
|
||||
{
|
||||
/* FIXME: errno handling */
|
||||
return j1(num);
|
||||
}
|
||||
|
||||
/*
|
||||
* @implemented
|
||||
*/
|
||||
double _y1(double num)
|
||||
{
|
||||
double retval;
|
||||
if (!isfinite(num)) *_errno() = EDOM;
|
||||
retval = y1(num);
|
||||
if (_fpclass(retval) == _FPCLASS_NINF)
|
||||
{
|
||||
*_errno() = EDOM;
|
||||
retval = sqrt(-1);
|
||||
}
|
||||
return retval;
|
||||
}
|
30
reactos/lib/sdk/crt/math/jn_yn.c
Normal file
30
reactos/lib/sdk/crt/math/jn_yn.c
Normal file
|
@ -0,0 +1,30 @@
|
|||
#include <math.h>
|
||||
|
||||
typedef int fpclass_t;
|
||||
fpclass_t _fpclass(double __d);
|
||||
int *_errno(void);
|
||||
|
||||
/*
|
||||
* @unimplemented
|
||||
*/
|
||||
double _jn(int n, double num)
|
||||
{
|
||||
/* FIXME: errno handling */
|
||||
return jn(n, num);
|
||||
}
|
||||
|
||||
/*
|
||||
* @implemented
|
||||
*/
|
||||
double _yn(int order, double num)
|
||||
{
|
||||
double retval;
|
||||
if (!isfinite(num)) *_errno() = EDOM;
|
||||
retval = yn(order,num);
|
||||
if (_fpclass(retval) == _FPCLASS_NINF)
|
||||
{
|
||||
*_errno() = EDOM;
|
||||
retval = sqrt(-1);
|
||||
}
|
||||
return retval;
|
||||
}
|
|
@ -1,11 +0,0 @@
|
|||
/**
|
||||
* This file has no copyright assigned and is placed in the Public Domain.
|
||||
* This file is part of the w64 mingw-runtime package.
|
||||
* No warranty is given; refer to the file DISCLAIMER.PD within this package.
|
||||
*/
|
||||
#include <math.h>
|
||||
|
||||
float log10f(float _X)
|
||||
{
|
||||
return ((float)log10((double)_X));
|
||||
}
|
|
@ -1,23 +0,0 @@
|
|||
/**
|
||||
* This file has no copyright assigned and is placed in the Public Domain.
|
||||
* This file is part of the w64 mingw-runtime package.
|
||||
* No warranty is given; refer to the file DISCLAIMER.PD within this package.
|
||||
*/
|
||||
/*
|
||||
* Written by J.T. Conklin <jtc@netbsd.org>.
|
||||
* Changes for long double by Ulrich Drepper <drepper@cygnus.com>
|
||||
* Public domain.
|
||||
*/
|
||||
|
||||
#include <math.h>
|
||||
|
||||
double
|
||||
logb (double x)
|
||||
{
|
||||
double res = 0.0;
|
||||
#ifdef __GNUC__
|
||||
asm ("fxtract\n\t"
|
||||
"fstp %%st" : "=t" (res) : "0" (x));
|
||||
#endif
|
||||
return res;
|
||||
}
|
|
@ -1,23 +0,0 @@
|
|||
/**
|
||||
* This file has no copyright assigned and is placed in the Public Domain.
|
||||
* This file is part of the w64 mingw-runtime package.
|
||||
* No warranty is given; refer to the file DISCLAIMER.PD within this package.
|
||||
*/
|
||||
/*
|
||||
* Written by J.T. Conklin <jtc@netbsd.org>.
|
||||
* Changes for long double by Ulrich Drepper <drepper@cygnus.com>
|
||||
* Public domain.
|
||||
*/
|
||||
|
||||
#include <math.h>
|
||||
|
||||
float
|
||||
logbf (float x)
|
||||
{
|
||||
float res = 0.0F;
|
||||
#ifndef __GNUC__
|
||||
asm ("fxtract\n\t"
|
||||
"fstp %%st" : "=t" (res) : "0" (x));
|
||||
#endif
|
||||
return res;
|
||||
}
|
|
@ -1,11 +0,0 @@
|
|||
/**
|
||||
* This file has no copyright assigned and is placed in the Public Domain.
|
||||
* This file is part of the w64 mingw-runtime package.
|
||||
* No warranty is given; refer to the file DISCLAIMER.PD within this package.
|
||||
*/
|
||||
#include <math.h>
|
||||
|
||||
float logf(float _X)
|
||||
{
|
||||
return ((float)log((double)_X));
|
||||
}
|
|
@ -1,27 +0,0 @@
|
|||
/**
|
||||
* This file has no copyright assigned and is placed in the Public Domain.
|
||||
* This file is part of the w64 mingw-runtime package.
|
||||
* No warranty is given; refer to the file DISCLAIMER.PD within this package.
|
||||
*/
|
||||
#include <fenv.h>
|
||||
#include <math.h>
|
||||
#include <errno.h>
|
||||
#define FE_ROUNDING_MASK \
|
||||
(FE_TONEAREST | FE_DOWNWARD | FE_UPWARD | FE_TOWARDZERO)
|
||||
|
||||
float
|
||||
modff (float value, float* iptr)
|
||||
{
|
||||
float int_part = 0.0F;
|
||||
unsigned short saved_cw;
|
||||
unsigned short tmp_cw;
|
||||
/* truncate */
|
||||
asm ("fnstcw %0;" : "=m" (saved_cw)); /* save control word */
|
||||
tmp_cw = (saved_cw & ~FE_ROUNDING_MASK) | FE_TOWARDZERO;
|
||||
asm ("fldcw %0;" : : "m" (tmp_cw));
|
||||
asm ("frndint;" : "=t" (int_part) : "0" (value)); /* round */
|
||||
asm ("fldcw %0;" : : "m" (saved_cw)); /* restore saved cw */
|
||||
if (iptr)
|
||||
*iptr = int_part;
|
||||
return (isinf (value) ? 0.0F : value - int_part);
|
||||
}
|
|
@ -1,66 +0,0 @@
|
|||
/**
|
||||
* This file has no copyright assigned and is placed in the Public Domain.
|
||||
* This file is part of the w64 mingw-runtime package.
|
||||
* No warranty is given; refer to the file DISCLAIMER.PD within this package.
|
||||
*/
|
||||
/*
|
||||
nextafterl.c
|
||||
Contributed by Danny Smith <dannysmith@users.sourceforge.net>
|
||||
No copyright claimed, absolutely no warranties.
|
||||
|
||||
2005-05-09
|
||||
*/
|
||||
|
||||
#include <math.h>
|
||||
|
||||
double
|
||||
nextafter (double x, double y)
|
||||
{
|
||||
union {
|
||||
long double ld;
|
||||
struct {
|
||||
/* packed attribute is unnecessary on x86/x64 for these three variables */
|
||||
unsigned long long mantissa;
|
||||
unsigned short expn;
|
||||
unsigned short pad;
|
||||
} parts;
|
||||
} u;
|
||||
|
||||
/* The normal bit is explicit for long doubles, unlike
|
||||
float and double. */
|
||||
static const unsigned long long normal_bit = 0x8000000000000000ull;
|
||||
u.ld = 0.0L;
|
||||
if (isnan (y) || isnan (x))
|
||||
return x + y;
|
||||
|
||||
if (x == y )
|
||||
/* nextafter (0.0, -O.0) should return -0.0. */
|
||||
return y;
|
||||
|
||||
u.ld = x;
|
||||
if (x == 0.0L)
|
||||
{
|
||||
u.parts.mantissa = 1ull;
|
||||
return y > 0.0L ? u.ld : -u.ld;
|
||||
}
|
||||
|
||||
if (((x > 0.0L) ^ (y > x)) == 0)
|
||||
{
|
||||
u.parts.mantissa++;
|
||||
if ((u.parts.mantissa & ~normal_bit) == 0ull)
|
||||
u.parts.expn++;
|
||||
}
|
||||
else
|
||||
{
|
||||
if ((u.parts.mantissa & ~normal_bit) == 0ull)
|
||||
u.parts.expn--;
|
||||
u.parts.mantissa--;
|
||||
}
|
||||
|
||||
/* If we have updated the expn of a normal number,
|
||||
or moved from denormal to normal, [re]set the normal bit. */
|
||||
if (u.parts.expn & 0x7fff)
|
||||
u.parts.mantissa |= normal_bit;
|
||||
|
||||
return u.ld;
|
||||
}
|
|
@ -1,32 +0,0 @@
|
|||
/**
|
||||
* This file has no copyright assigned and is placed in the Public Domain.
|
||||
* This file is part of the w64 mingw-runtime package.
|
||||
* No warranty is given; refer to the file DISCLAIMER.PD within this package.
|
||||
*/
|
||||
#include <math.h>
|
||||
|
||||
float
|
||||
nextafterf (float x, float y)
|
||||
{
|
||||
union
|
||||
{
|
||||
float f;
|
||||
unsigned int i;
|
||||
} u;
|
||||
if (isnan (y) || isnan (x))
|
||||
return x + y;
|
||||
if (x == y )
|
||||
/* nextafter (0.0, -O.0) should return -0.0. */
|
||||
return y;
|
||||
u.f = x;
|
||||
if (x == 0.0F)
|
||||
{
|
||||
u.i = 1;
|
||||
return y > 0.0F ? u.f : -u.f;
|
||||
}
|
||||
if (((x > 0.0F) ^ (y > x)) == 0)
|
||||
u.i++;
|
||||
else
|
||||
u.i--;
|
||||
return u.f;
|
||||
}
|
|
@ -21,24 +21,11 @@
|
|||
|
||||
#include <math.h>
|
||||
|
||||
double ldexp (double __x, int __y);
|
||||
/*
|
||||
* @implemented
|
||||
*/
|
||||
|
||||
double ldexp (double __x, int __y)
|
||||
long double powl (long double __x,long double __y)
|
||||
{
|
||||
register double __val;
|
||||
#ifdef __GNUC__
|
||||
__asm __volatile__
|
||||
("fscale"
|
||||
: "=t" (__val) : "0" (__x), "u" ((double) __y));
|
||||
#else
|
||||
register double __dy = (double)__y;
|
||||
__asm
|
||||
{
|
||||
fld __dy
|
||||
fld __x
|
||||
fscale
|
||||
fstp __val
|
||||
}
|
||||
#endif /*__GNUC__*/
|
||||
return __val;
|
||||
return pow(__x,__y/2)*pow(__x,__y/2);
|
||||
}
|
|
@ -1,10 +0,0 @@
|
|||
/**
|
||||
* This file has no copyright assigned and is placed in the Public Domain.
|
||||
* This file is part of the w64 mingw-runtime package.
|
||||
* No warranty is given; refer to the file DISCLAIMER.PD within this package.
|
||||
*/
|
||||
#include <math.h>
|
||||
float powf (float x, float y)
|
||||
{
|
||||
return (float) pow ((double) x, (double) y);
|
||||
}
|
|
@ -1,11 +0,0 @@
|
|||
/**
|
||||
* This file has no copyright assigned and is placed in the Public Domain.
|
||||
* This file is part of the w64 mingw-runtime package.
|
||||
* No warranty is given; refer to the file DISCLAIMER.PD within this package.
|
||||
*/
|
||||
#include <math.h>
|
||||
|
||||
float sinf(float _X)
|
||||
{
|
||||
return ((float) sin ((double) _X));
|
||||
}
|
|
@ -1,10 +0,0 @@
|
|||
/**
|
||||
* This file has no copyright assigned and is placed in the Public Domain.
|
||||
* This file is part of the w64 mingw-runtime package.
|
||||
* No warranty is given; refer to the file DISCLAIMER.PD within this package.
|
||||
*/
|
||||
#include <math.h>
|
||||
float sinhf (float x)
|
||||
{
|
||||
return (float) sinh (x);
|
||||
}
|
|
@ -1,25 +0,0 @@
|
|||
/**
|
||||
* This file has no copyright assigned and is placed in the Public Domain.
|
||||
* This file is part of the w64 mingw-runtime package.
|
||||
* No warranty is given; refer to the file DISCLAIMER.PD within this package.
|
||||
*/
|
||||
#include <math.h>
|
||||
#include <errno.h>
|
||||
|
||||
double
|
||||
sqrt (double x)
|
||||
{
|
||||
if (x < 0.0L )
|
||||
{
|
||||
#ifndef _LIBCNT_
|
||||
errno = EDOM;
|
||||
#endif
|
||||
return NAN;
|
||||
}
|
||||
else
|
||||
{
|
||||
long double res = 0.0L;
|
||||
asm ("fsqrt" : "=t" (res) : "0" (x));
|
||||
return res;
|
||||
}
|
||||
}
|
|
@ -1,23 +0,0 @@
|
|||
/**
|
||||
* This file has no copyright assigned and is placed in the Public Domain.
|
||||
* This file is part of the w64 mingw-runtime package.
|
||||
* No warranty is given; refer to the file DISCLAIMER.PD within this package.
|
||||
*/
|
||||
#include <math.h>
|
||||
#include <errno.h>
|
||||
|
||||
float
|
||||
sqrtf (float x)
|
||||
{
|
||||
if (x < 0.0F )
|
||||
{
|
||||
errno = EDOM;
|
||||
return NAN;
|
||||
}
|
||||
else
|
||||
{
|
||||
float res = 0.0F;
|
||||
asm ("fsqrt" : "=t" (res) : "0" (x));
|
||||
return res;
|
||||
}
|
||||
}
|
|
@ -1,11 +0,0 @@
|
|||
/**
|
||||
* This file has no copyright assigned and is placed in the Public Domain.
|
||||
* This file is part of the w64 mingw-runtime package.
|
||||
* No warranty is given; refer to the file DISCLAIMER.PD within this package.
|
||||
*/
|
||||
#include <math.h>
|
||||
|
||||
float tanf(float _X)
|
||||
{
|
||||
return ((float)tan((double)_X));
|
||||
}
|
|
@ -1,10 +0,0 @@
|
|||
/**
|
||||
* This file has no copyright assigned and is placed in the Public Domain.
|
||||
* This file is part of the w64 mingw-runtime package.
|
||||
* No warranty is given; refer to the file DISCLAIMER.PD within this package.
|
||||
*/
|
||||
#include <math.h>
|
||||
float tanhf (float x)
|
||||
{
|
||||
return (float) tanh (x);
|
||||
}
|
|
@ -117,6 +117,11 @@ static CRITICAL_SECTION FILE_cs;
|
|||
#define LOCK_FILES() do { EnterCriticalSection(&FILE_cs); } while (0)
|
||||
#define UNLOCK_FILES() do { LeaveCriticalSection(&FILE_cs); } while (0)
|
||||
|
||||
FILE *__cdecl __iob_func()
|
||||
{
|
||||
return _iob;
|
||||
}
|
||||
|
||||
static inline BOOL is_valid_fd(int fd)
|
||||
{
|
||||
return fd >= 0 && fd < fdend && (fdesc[fd].wxflag & WX_OPEN);
|
||||
|
@ -447,11 +452,11 @@ static void int_to_base32(int num, char *str)
|
|||
}
|
||||
|
||||
/*********************************************************************
|
||||
* __iob_func(MSVCRT.@)
|
||||
* __p__iob(MSVCRT.@)
|
||||
*/
|
||||
FILE * CDECL __iob_func(void)
|
||||
FILE * CDECL __p__iob(void)
|
||||
{
|
||||
return &_iob[0];
|
||||
return _iob;
|
||||
}
|
||||
|
||||
/*********************************************************************
|
||||
|
|
|
@ -292,12 +292,12 @@ const unsigned short _ctype[] = {
|
|||
const unsigned short *_pctype = _ctype + 1;
|
||||
const unsigned short *_pwctype = _ctype + 1;
|
||||
|
||||
/*********************************************************************
|
||||
* __pctype_func (MSVCRT.@)
|
||||
/*
|
||||
* @implemented
|
||||
*/
|
||||
const unsigned short* __cdecl __pctype_func(void)
|
||||
const unsigned short **__p__pctype(void)
|
||||
{
|
||||
return _pctype;
|
||||
return &_pctype;
|
||||
}
|
||||
|
||||
/*
|
||||
|
|
|
@ -5,7 +5,6 @@
|
|||
* PURPOSE: Implementation of asctime(), _asctime_s()
|
||||
* PROGRAMERS: Timo Kreuzer
|
||||
*/
|
||||
#define MINGW_HAS_SECURE_API
|
||||
#include <precomp.h>
|
||||
#include <tchar.h>
|
||||
#include <time.h>
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
* PURPOSE: Implementation of ctime, _ctime_s
|
||||
* PROGRAMERS: Timo Kreuzer
|
||||
*/
|
||||
#define MINGW_HAS_SECURE_API
|
||||
#define MINGW_HAS_SECURE_API 1
|
||||
|
||||
#include <tchar.h>
|
||||
#include <time.h>
|
||||
|
|
|
@ -10,7 +10,7 @@
|
|||
#include <sys/utime.h>
|
||||
#include "bitsfixup.h"
|
||||
|
||||
int __cdecl
|
||||
int
|
||||
_tutime(const _TCHAR* path, struct _utimbuf *t)
|
||||
{
|
||||
int fd = _topen(path, _O_WRONLY | _O_BINARY);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue