Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wine-cw
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-cw
Commits
0a105999
Commit
0a105999
authored
Apr 29, 2021
by
Piotr Caban
Committed by
Alexandre Julliard
Apr 29, 2021
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
msvcrt: Import jn implementation from musl.
Signed-off-by:
Piotr Caban
<
piotr@codeweavers.com
>
Signed-off-by:
Alexandre Julliard
<
julliard@winehq.org
>
parent
e10bd6f4
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
125 additions
and
23 deletions
+125
-23
configure
configure
+0
-1
configure.ac
configure.ac
+0
-1
math.c
dlls/msvcrt/math.c
+125
-3
unixlib.c
dlls/msvcrt/unixlib.c
+0
-14
unixlib.h
dlls/msvcrt/unixlib.h
+0
-1
config.h.in
include/config.h.in
+0
-3
No files found.
configure
View file @
0a105999
...
...
@@ -19631,7 +19631,6 @@ for ac_func in \
expm1f
\
fma
\
fmaf
\
jn
\
lgamma
\
lgammaf
\
llrint
\
...
...
configure.ac
View file @
0a105999
...
...
@@ -2674,7 +2674,6 @@ AC_CHECK_FUNCS(\
expm1f \
fma \
fmaf \
jn \
lgamma \
lgammaf \
llrint \
...
...
dlls/msvcrt/math.c
View file @
0a105999
...
...
@@ -2912,11 +2912,133 @@ double CDECL _j1(double x)
/*********************************************************************
* _jn (MSVCRT.@)
*
* Copied from musl: src/math/jn.c
*/
double
CDECL
_jn
(
int
n
,
double
num
)
double
CDECL
_jn
(
int
n
,
double
x
)
{
/* FIXME: errno handling */
return
unix_funcs
->
jn
(
n
,
num
);
static
const
double
invsqrtpi
=
5.64189583547756279280e-01
;
unsigned
int
ix
,
lx
;
int
nm1
,
i
,
sign
;
double
a
,
b
,
temp
;
ix
=
*
(
ULONGLONG
*
)
&
x
>>
32
;
lx
=
*
(
ULONGLONG
*
)
&
x
;
sign
=
ix
>>
31
;
ix
&=
0x7fffffff
;
if
((
ix
|
(
lx
|
-
lx
)
>>
31
)
>
0x7ff00000
)
/* nan */
return
x
;
if
(
n
==
0
)
return
_j0
(
x
);
if
(
n
<
0
)
{
nm1
=
-
(
n
+
1
);
x
=
-
x
;
sign
^=
1
;
}
else
{
nm1
=
n
-
1
;
}
if
(
nm1
==
0
)
return
j1
(
x
);
sign
&=
n
;
/* even n: 0, odd n: signbit(x) */
x
=
fabs
(
x
);
if
((
ix
|
lx
)
==
0
||
ix
==
0x7ff00000
)
/* if x is 0 or inf */
b
=
0
.
0
;
else
if
(
nm1
<
x
)
{
if
(
ix
>=
0x52d00000
)
{
/* x > 2**302 */
switch
(
nm1
&
3
)
{
case
0
:
temp
=
-
cos
(
x
)
+
sin
(
x
);
break
;
case
1
:
temp
=
-
cos
(
x
)
-
sin
(
x
);
break
;
case
2
:
temp
=
cos
(
x
)
-
sin
(
x
);
break
;
default:
temp
=
cos
(
x
)
+
sin
(
x
);
break
;
}
b
=
invsqrtpi
*
temp
/
sqrt
(
x
);
}
else
{
a
=
_j0
(
x
);
b
=
_j1
(
x
);
for
(
i
=
0
;
i
<
nm1
;
)
{
i
++
;
temp
=
b
;
b
=
b
*
(
2
.
0
*
i
/
x
)
-
a
;
/* avoid underflow */
a
=
temp
;
}
}
}
else
{
if
(
ix
<
0x3e100000
)
{
/* x < 2**-29 */
if
(
nm1
>
32
)
/* underflow */
b
=
0
.
0
;
else
{
temp
=
x
*
0
.
5
;
b
=
temp
;
a
=
1
.
0
;
for
(
i
=
2
;
i
<=
nm1
+
1
;
i
++
)
{
a
*=
(
double
)
i
;
/* a = n! */
b
*=
temp
;
/* b = (x/2)^n */
}
b
=
b
/
a
;
}
}
else
{
double
t
,
q0
,
q1
,
w
,
h
,
z
,
tmp
,
nf
;
int
k
;
nf
=
nm1
+
1
.
0
;
w
=
2
*
nf
/
x
;
h
=
2
/
x
;
z
=
w
+
h
;
q0
=
w
;
q1
=
w
*
z
-
1
.
0
;
k
=
1
;
while
(
q1
<
1.0e9
)
{
k
+=
1
;
z
+=
h
;
tmp
=
z
*
q1
-
q0
;
q0
=
q1
;
q1
=
tmp
;
}
for
(
t
=
0
.
0
,
i
=
k
;
i
>=
0
;
i
--
)
t
=
1
/
(
2
*
(
i
+
nf
)
/
x
-
t
);
a
=
t
;
b
=
1
.
0
;
tmp
=
nf
*
log
(
fabs
(
w
));
if
(
tmp
<
7.09782712893383973096e+02
)
{
for
(
i
=
nm1
;
i
>
0
;
i
--
)
{
temp
=
b
;
b
=
b
*
(
2
.
0
*
i
)
/
x
-
a
;
a
=
temp
;
}
}
else
{
for
(
i
=
nm1
;
i
>
0
;
i
--
)
{
temp
=
b
;
b
=
b
*
(
2
.
0
*
i
)
/
x
-
a
;
a
=
temp
;
/* scale b to avoid spurious overflow */
if
(
b
>
0x1
p500
)
{
a
/=
b
;
t
/=
b
;
b
=
1
.
0
;
}
}
}
z
=
j0
(
x
);
w
=
j1
(
x
);
if
(
fabs
(
z
)
>=
fabs
(
w
))
b
=
t
*
z
/
b
;
else
b
=
t
*
w
/
a
;
}
}
return
sign
?
-
b
:
b
;
}
/*********************************************************************
...
...
dlls/msvcrt/unixlib.c
View file @
0a105999
...
...
@@ -402,19 +402,6 @@ static float CDECL unix_hypotf(float x, float y)
}
/*********************************************************************
* jn
*/
static
double
CDECL
unix_jn
(
int
n
,
double
num
)
{
#ifdef HAVE_JN
return
jn
(
n
,
num
);
#else
FIXME
(
"not implemented
\n
"
);
return
0
;
#endif
}
/*********************************************************************
* ldexp
*/
static
double
CDECL
unix_ldexp
(
double
num
,
int
exp
)
...
...
@@ -1001,7 +988,6 @@ static const struct unix_funcs funcs =
unix_frexpf
,
unix_hypot
,
unix_hypotf
,
unix_jn
,
unix_ldexp
,
unix_lgamma
,
unix_lgammaf
,
...
...
dlls/msvcrt/unixlib.h
View file @
0a105999
...
...
@@ -57,7 +57,6 @@ struct unix_funcs
float
(
CDECL
*
frexpf
)(
float
x
,
int
*
exp
);
double
(
CDECL
*
hypot
)(
double
x
,
double
y
);
float
(
CDECL
*
hypotf
)(
float
x
,
float
y
);
double
(
CDECL
*
jn
)(
int
n
,
double
num
);
double
(
CDECL
*
ldexp
)(
double
x
,
int
exp
);
double
(
CDECL
*
lgamma
)(
double
x
);
float
(
CDECL
*
lgammaf
)(
float
x
);
...
...
include/config.h.in
View file @
0a105999
...
...
@@ -288,9 +288,6 @@
/* Define to 1 if you have the `isnan' function. */
#undef HAVE_ISNAN
/* Define to 1 if you have the `jn' function. */
#undef HAVE_JN
/* Define to 1 if you have the <jpeglib.h> header file. */
#undef HAVE_JPEGLIB_H
...
...
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