Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wine-winehq
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
wine
wine-winehq
Commits
07e31f4e
Commit
07e31f4e
authored
Jun 10, 2021
by
Piotr Caban
Committed by
Alexandre Julliard
Jun 10, 2021
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
msvcrt: Import exp2f implementation from musl.
Signed-off-by:
Piotr Caban
<
piotr@codeweavers.com
>
Signed-off-by:
Alexandre Julliard
<
julliard@winehq.org
>
parent
2fb789f5
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
57 additions
and
24 deletions
+57
-24
configure
configure
+1
-2
configure.ac
configure.ac
+1
-2
math.c
dlls/msvcrt/math.c
+55
-3
unixlib.c
dlls/msvcrt/unixlib.c
+0
-13
unixlib.h
dlls/msvcrt/unixlib.h
+0
-1
config.h.in
include/config.h.in
+0
-3
No files found.
configure
View file @
07e31f4e
...
...
@@ -19620,8 +19620,7 @@ $as_echo "#define HAVE_ISNAN 1" >>confdefs.h
fi
for
ac_func
in
\
exp2
\
exp2f
exp2
do
:
as_ac_var
=
`
$as_echo
"ac_cv_func_
$ac_func
"
|
$as_tr_sh
`
...
...
configure.ac
View file @
07e31f4e
...
...
@@ -2659,8 +2659,7 @@ then
fi
AC_CHECK_FUNCS(\
exp2 \
exp2f
exp2
)
LIBS="$ac_save_LIBS"
...
...
dlls/msvcrt/math.c
View file @
07e31f4e
...
...
@@ -7025,12 +7025,64 @@ double CDECL exp2(double x)
/*********************************************************************
* exp2f (MSVCR120.@)
*
* Copied from musl: src/math/exp2f.c
*/
float
CDECL
exp2f
(
float
x
)
{
float
ret
=
unix_funcs
->
exp2f
(
x
);
if
(
isfinite
(
x
)
&&
!
isfinite
(
ret
))
*
_errno
()
=
ERANGE
;
return
ret
;
static
const
UINT64
T
[]
=
{
0x3ff0000000000000ULL
,
0x3fefd9b0d3158574ULL
,
0x3fefb5586cf9890fULL
,
0x3fef9301d0125b51ULL
,
0x3fef72b83c7d517bULL
,
0x3fef54873168b9aaULL
,
0x3fef387a6e756238ULL
,
0x3fef1e9df51fdee1ULL
,
0x3fef06fe0a31b715ULL
,
0x3feef1a7373aa9cbULL
,
0x3feedea64c123422ULL
,
0x3feece086061892dULL
,
0x3feebfdad5362a27ULL
,
0x3feeb42b569d4f82ULL
,
0x3feeab07dd485429ULL
,
0x3feea47eb03a5585ULL
,
0x3feea09e667f3bcdULL
,
0x3fee9f75e8ec5f74ULL
,
0x3feea11473eb0187ULL
,
0x3feea589994cce13ULL
,
0x3feeace5422aa0dbULL
,
0x3feeb737b0cdc5e5ULL
,
0x3feec49182a3f090ULL
,
0x3feed503b23e255dULL
,
0x3feee89f995ad3adULL
,
0x3feeff76f2fb5e47ULL
,
0x3fef199bdd85529cULL
,
0x3fef3720dcef9069ULL
,
0x3fef5818dcfba487ULL
,
0x3fef7c97337b9b5fULL
,
0x3fefa4afa2a490daULL
,
0x3fefd0765b6e4540ULL
};
static
const
double
C
[]
=
{
0x1
.
c6af84b912394p
-
5
,
0x1
.
ebfce50fac4f3p
-
3
,
0x1
.62e42
ff0c52d6p
-
1
};
static
const
double
shift
=
0x1
.
8
p
+
52
/
(
1
<<
5
);
double
kd
,
xd
,
z
,
r
,
r2
,
y
,
s
;
UINT32
abstop
;
UINT64
ki
,
t
;
xd
=
x
;
abstop
=
(
*
(
UINT32
*
)
&
x
>>
20
)
&
0x7ff
;
if
(
abstop
>=
0x430
)
{
/* |x| >= 128 or x is nan. */
if
(
*
(
UINT32
*
)
&
x
==
0xff800000
)
return
0
.
0
f
;
if
(
abstop
>=
0x7f8
)
return
x
+
x
;
if
(
x
>
0
.
0
f
)
{
*
_errno
()
=
ERANGE
;
return
fp_barrierf
(
x
*
FLT_MAX
);
}
if
(
x
<=
-
150
.
0
f
)
{
fp_barrierf
(
x
-
0x1
p120
);
return
0
;
}
}
/* x = k/N + r with r in [-1/(2N), 1/(2N)] and int k, N = 1 << 5. */
kd
=
xd
+
shift
;
ki
=
*
(
UINT64
*
)
&
kd
;
kd
-=
shift
;
/* k/(1<<5) for int k. */
r
=
xd
-
kd
;
/* exp2(x) = 2^(k/N) * 2^r ~= s * (C0*r^3 + C1*r^2 + C2*r + 1) */
t
=
T
[
ki
%
(
1
<<
5
)];
t
+=
ki
<<
(
52
-
5
);
s
=
*
(
double
*
)
&
t
;
z
=
C
[
0
]
*
r
+
C
[
1
];
r2
=
r
*
r
;
y
=
C
[
2
]
*
r
+
1
;
y
=
z
*
r2
+
y
;
y
=
y
*
s
;
return
y
;
}
/*********************************************************************
...
...
dlls/msvcrt/unixlib.c
View file @
07e31f4e
...
...
@@ -71,18 +71,6 @@ static double CDECL unix_exp2( double x )
}
/*********************************************************************
* exp2f
*/
static
float
CDECL
unix_exp2f
(
float
x
)
{
#ifdef HAVE_EXP2F
return
exp2f
(
x
);
#else
return
unix_exp2
(
x
);
#endif
}
/*********************************************************************
* pow
*/
static
double
CDECL
unix_pow
(
double
x
,
double
y
)
...
...
@@ -103,7 +91,6 @@ static const struct unix_funcs funcs =
unix_exp
,
unix_expf
,
unix_exp2
,
unix_exp2f
,
unix_pow
,
unix_powf
,
};
...
...
dlls/msvcrt/unixlib.h
View file @
07e31f4e
...
...
@@ -26,7 +26,6 @@ struct unix_funcs
double
(
CDECL
*
exp
)(
double
x
);
float
(
CDECL
*
expf
)(
float
x
);
double
(
CDECL
*
exp2
)(
double
x
);
float
(
CDECL
*
exp2f
)(
float
x
);
double
(
CDECL
*
pow
)(
double
x
,
double
y
);
float
(
CDECL
*
powf
)(
float
x
,
float
y
);
};
...
...
include/config.h.in
View file @
07e31f4e
...
...
@@ -95,9 +95,6 @@
/* Define to 1 if you have the `exp2' function. */
#undef HAVE_EXP2
/* Define to 1 if you have the `exp2f' function. */
#undef HAVE_EXP2F
/* Define to 1 if you have the `F3DAudioInitialize8' function. */
#undef HAVE_F3DAUDIOINITIALIZE8
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment