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
f041eeab
Commit
f041eeab
authored
May 14, 2021
by
Piotr Caban
Committed by
Alexandre Julliard
May 14, 2021
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
msvcrt: Import nextafter implementation from musl.
Signed-off-by:
Piotr Caban
<
piotr@codeweavers.com
>
Signed-off-by:
Alexandre Julliard
<
julliard@winehq.org
>
parent
854a3cab
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
38 additions
and
17 deletions
+38
-17
math.c
dlls/msvcrt/math.c
+38
-7
unixlib.c
dlls/msvcrt/unixlib.c
+0
-9
unixlib.h
dlls/msvcrt/unixlib.h
+0
-1
No files found.
dlls/msvcrt/math.c
View file @
f041eeab
...
...
@@ -87,13 +87,11 @@ static inline float fp_barrierf(float x)
return
y
;
}
#if _MSVCR_VER>=120
static
inline
double
fp_barrier
(
double
x
)
{
volatile
double
y
=
x
;
return
y
;
}
#endif
static
inline
double
CDECL
ret_nan
(
BOOL
update_sw
)
{
...
...
@@ -3482,13 +3480,46 @@ float CDECL MSVCRT_nexttowardf(float num, double next)
/*********************************************************************
* _nextafter (MSVCRT.@)
*
* Copied from musl: src/math/nextafter.c
*/
double
CDECL
_nextafter
(
double
num
,
double
next
)
double
CDECL
_nextafter
(
double
x
,
double
y
)
{
double
retval
;
if
(
!
isfinite
(
num
)
||
!
isfinite
(
next
))
*
_errno
()
=
EDOM
;
retval
=
unix_funcs
->
nextafter
(
num
,
next
);
return
retval
;
ULONGLONG
llx
=
*
(
ULONGLONG
*
)
&
x
;
ULONGLONG
lly
=
*
(
ULONGLONG
*
)
&
y
;
ULONGLONG
ax
,
ay
;
int
e
;
if
(
isnan
(
x
)
||
isnan
(
y
))
return
x
+
y
;
if
(
llx
==
lly
)
{
if
(
_fpclass
(
y
)
&
(
_FPCLASS_ND
|
_FPCLASS_PD
|
_FPCLASS_NZ
|
_FPCLASS_PZ
))
*
_errno
()
=
ERANGE
;
return
y
;
}
ax
=
llx
&
-
1ULL
/
2
;
ay
=
lly
&
-
1ULL
/
2
;
if
(
ax
==
0
)
{
if
(
ay
==
0
)
return
y
;
llx
=
(
lly
&
1ULL
<<
63
)
|
1
;
}
else
if
(
ax
>
ay
||
((
llx
^
lly
)
&
1ULL
<<
63
))
llx
--
;
else
llx
++
;
e
=
llx
>>
52
&
0x7ff
;
/* raise overflow if llx is infinite and x is finite */
if
(
e
==
0x7ff
)
{
fp_barrier
(
x
+
x
);
*
_errno
()
=
ERANGE
;
}
/* raise underflow if llx is subnormal or zero */
y
=
*
(
double
*
)
&
llx
;
if
(
e
==
0
)
{
fp_barrier
(
x
*
x
+
y
*
y
);
*
_errno
()
=
ERANGE
;
}
return
y
;
}
/*********************************************************************
...
...
dlls/msvcrt/unixlib.c
View file @
f041eeab
...
...
@@ -548,14 +548,6 @@ static float CDECL unix_modff( float x, float *iptr )
}
/*********************************************************************
* nextafter
*/
static
double
CDECL
unix_nextafter
(
double
num
,
double
next
)
{
return
nextafter
(
num
,
next
);
}
/*********************************************************************
* nextafterf
*/
static
float
CDECL
unix_nextafterf
(
float
num
,
float
next
)
...
...
@@ -822,7 +814,6 @@ static const struct unix_funcs funcs =
unix_logbf
,
unix_modf
,
unix_modff
,
unix_nextafter
,
unix_nextafterf
,
unix_nexttoward
,
unix_nexttowardf
,
...
...
dlls/msvcrt/unixlib.h
View file @
f041eeab
...
...
@@ -72,7 +72,6 @@ struct unix_funcs
float
(
CDECL
*
logbf
)(
float
x
);
double
(
CDECL
*
modf
)(
double
x
,
double
*
iptr
);
float
(
CDECL
*
modff
)(
float
x
,
float
*
iptr
);
double
(
CDECL
*
nextafter
)(
double
x
,
double
y
);
float
(
CDECL
*
nextafterf
)(
float
x
,
float
y
);
double
(
CDECL
*
nexttoward
)(
double
x
,
double
y
);
float
(
CDECL
*
nexttowardf
)(
float
x
,
double
y
);
...
...
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