mirror of
https://github.com/reactos/reactos.git
synced 2025-08-05 18:02:56 +00:00
[CRT] Add a generic C version of exp2(f) and use it for all architecture
This commit is contained in:
parent
a19ca409ae
commit
199adee3fe
4 changed files with 32 additions and 40 deletions
13
sdk/lib/crt/math/exp2.c
Normal file
13
sdk/lib/crt/math/exp2.c
Normal file
|
@ -0,0 +1,13 @@
|
|||
|
||||
#include <math.h>
|
||||
|
||||
_Check_return_
|
||||
double
|
||||
__cdecl
|
||||
exp2(
|
||||
_In_ double x)
|
||||
{
|
||||
/* This below avoids clang to optimize our pow call to exp2 */
|
||||
static const TWO = 2.0;
|
||||
return pow(TWO, x);
|
||||
}
|
13
sdk/lib/crt/math/exp2f.c
Normal file
13
sdk/lib/crt/math/exp2f.c
Normal file
|
@ -0,0 +1,13 @@
|
|||
|
||||
#include <math.h>
|
||||
|
||||
_Check_return_
|
||||
float
|
||||
__cdecl
|
||||
exp2f(
|
||||
_In_ float x)
|
||||
{
|
||||
/* This below avoids clang to optimize our pow call to exp2 */
|
||||
static const TWO = 2.0f;
|
||||
return powf(TWO, x);
|
||||
}
|
|
@ -1,38 +0,0 @@
|
|||
#include <asm.inc>
|
||||
|
||||
PUBLIC _exp2
|
||||
|
||||
/* FUNCTIONS ***************************************************************/
|
||||
.code
|
||||
|
||||
_exp2:
|
||||
push ebp
|
||||
mov ebp, esp
|
||||
|
||||
fld qword ptr [ebp + 8]
|
||||
fxam
|
||||
fstsw ax
|
||||
fwait
|
||||
sahf
|
||||
jnp .not_inf
|
||||
jnc .not_inf
|
||||
test ah, 2
|
||||
jz .done
|
||||
fstp st
|
||||
fldz
|
||||
jmp .done
|
||||
.not_inf:
|
||||
fst st(1)
|
||||
frndint
|
||||
fxch st(1)
|
||||
fsub st, st(1)
|
||||
f2xm1
|
||||
fld1
|
||||
faddp st(1), st
|
||||
fscale
|
||||
fstp st(1)
|
||||
.done:
|
||||
pop ebp
|
||||
ret
|
||||
|
||||
END
|
Loading…
Add table
Add a link
Reference in a new issue