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
554e7aee
Commit
554e7aee
authored
Mar 30, 2023
by
Alexandre Julliard
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
msvcrt: Use the rint()/rintf() implementation from the bundled musl library.
parent
c26fd262
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
30 additions
and
69 deletions
+30
-69
msvcr120.spec
dlls/msvcr120/msvcr120.spec
+2
-2
math.c
dlls/msvcrt/math.c
+20
-59
ucrtbase.spec
dlls/ucrtbase/ucrtbase.spec
+4
-4
rint.c
libs/musl/src/math/rint.c
+2
-2
rintf.c
libs/musl/src/math/rintf.c
+2
-2
No files found.
dlls/msvcr120/msvcr120.spec
View file @
554e7aee
...
...
@@ -2334,9 +2334,9 @@
@ cdecl remquol(double double ptr) remquo
@ cdecl rename(str str)
@ cdecl rewind(ptr)
@ cdecl rint(double)
@ cdecl rint(double)
MSVCRT_rint
@ cdecl rintf(float)
@ cdecl rintl(double) rint
@ cdecl rintl(double)
MSVCRT_
rint
@ cdecl round(double)
@ cdecl roundf(float)
@ cdecl roundl(double) round
...
...
dlls/msvcrt/math.c
View file @
554e7aee
...
...
@@ -953,37 +953,6 @@ double CDECL atan( double x )
return
sign
?
-
z
:
z
;
}
/*********************************************************************
* rint (MSVCR120.@)
*
* Copied from musl: src/math/rint.c
*/
double
CDECL
rint
(
double
x
)
{
static
const
double
toint
=
1
/
DBL_EPSILON
;
ULONGLONG
llx
=
*
(
ULONGLONG
*
)
&
x
;
int
e
=
llx
>>
52
&
0x7ff
;
int
s
=
llx
>>
63
;
unsigned
cw
;
double
y
;
if
(
e
>=
0x3ff
+
52
)
return
x
;
cw
=
_controlfp
(
0
,
0
);
if
((
cw
&
_MCW_PC
)
!=
_PC_53
)
_controlfp
(
_PC_53
,
_MCW_PC
);
if
(
s
)
y
=
fp_barrier
(
x
-
toint
)
+
toint
;
else
y
=
fp_barrier
(
x
+
toint
)
-
toint
;
if
((
cw
&
_MCW_PC
)
!=
_PC_53
)
_controlfp
(
cw
,
_MCW_PC
);
if
(
y
==
0
)
return
s
?
-
0
.
0
:
0
;
return
y
;
}
/* Copied from musl: src/math/exp_data.c */
static
const
UINT64
exp_T
[]
=
{
0x0ULL
,
0x3ff0000000000000ULL
,
...
...
@@ -2568,6 +2537,23 @@ int CDECL _isnan(double num)
#if _MSVCR_VER>=120
/*********************************************************************
* rint (MSVCR120.@)
*/
double
CDECL
MSVCRT_rint
(
double
x
)
{
unsigned
cw
;
double
y
;
cw
=
_controlfp
(
0
,
0
);
if
((
cw
&
_MCW_PC
)
!=
_PC_53
)
_controlfp
(
_PC_53
,
_MCW_PC
);
y
=
rint
(
x
);
if
((
cw
&
_MCW_PC
)
!=
_PC_53
)
_controlfp
(
cw
,
_MCW_PC
);
return
y
;
}
/*********************************************************************
* _nearbyint (MSVCR120.@)
*
* Based on musl: src/math/nearbyteint.c
...
...
@@ -2585,7 +2571,7 @@ double CDECL nearbyint(double x)
cw
|=
_EM_INEXACT
;
_setfp
(
&
cw
,
_EM_INEXACT
,
NULL
,
0
);
}
x
=
rint
(
x
);
x
=
MSVCRT_
rint
(
x
);
if
(
update_cw
||
update_sw
)
{
sw
=
0
;
...
...
@@ -3512,38 +3498,13 @@ void __cdecl __libm_sse2_sqrt_precise(void)
#if _MSVCR_VER>=120
/*********************************************************************
* rintf (MSVCR120.@)
*
* Copied from musl: src/math/rintf.c
*/
float
CDECL
rintf
(
float
x
)
{
static
const
float
toint
=
1
/
FLT_EPSILON
;
unsigned
int
ix
=
*
(
unsigned
int
*
)
&
x
;
int
e
=
ix
>>
23
&
0xff
;
int
s
=
ix
>>
31
;
float
y
;
if
(
e
>=
0x7f
+
23
)
return
x
;
if
(
s
)
y
=
fp_barrierf
(
x
-
toint
)
+
toint
;
else
y
=
fp_barrierf
(
x
+
toint
)
-
toint
;
if
(
y
==
0
)
return
s
?
-
0
.
0
f
:
0
.
0
f
;
return
y
;
}
/*********************************************************************
* lrint (MSVCR120.@)
*/
__msvcrt_long
CDECL
lrint
(
double
x
)
{
double
d
;
d
=
rint
(
x
);
d
=
MSVCRT_
rint
(
x
);
if
((
d
<
0
&&
d
!=
(
double
)(
__msvcrt_long
)
d
)
||
(
d
>=
0
&&
d
!=
(
double
)(
__msvcrt_ulong
)
d
))
{
*
_errno
()
=
EDOM
;
...
...
@@ -3575,7 +3536,7 @@ __int64 CDECL llrint(double x)
{
double
d
;
d
=
rint
(
x
);
d
=
MSVCRT_
rint
(
x
);
if
((
d
<
0
&&
d
!=
(
double
)(
__int64
)
d
)
||
(
d
>=
0
&&
d
!=
(
double
)(
unsigned
__int64
)
d
))
{
*
_errno
()
=
EDOM
;
...
...
dlls/ucrtbase/ucrtbase.spec
View file @
554e7aee
...
...
@@ -1758,9 +1758,9 @@
@ cdecl _o_remquol(double double ptr) remquo
@ cdecl _o_rename(str str) rename
@ cdecl _o_rewind(ptr) rewind
@ cdecl _o_rint(double) rint
@ cdecl _o_rint(double)
MSVCRT_
rint
@ cdecl _o_rintf(float) rintf
@ cdecl _o_rintl(double) rint
@ cdecl _o_rintl(double)
MSVCRT_
rint
@ cdecl _o_round(double) round
@ cdecl _o_roundf(float) roundf
@ cdecl _o_roundl(double) round
...
...
@@ -2471,9 +2471,9 @@
@ cdecl remquol(double double ptr) remquo
@ cdecl rename(str str)
@ cdecl rewind(ptr)
@ cdecl rint(double)
@ cdecl rint(double)
MSVCRT_rint
@ cdecl rintf(float)
@ cdecl rintl(double) rint
@ cdecl rintl(double)
MSVCRT_
rint
@ cdecl round(double)
@ cdecl roundf(float)
@ cdecl roundl(double) round
...
...
libs/musl/src/math/rint.c
View file @
554e7aee
...
...
@@ -20,9 +20,9 @@ double __cdecl rint(double x)
if
(
e
>=
0x3ff
+
52
)
return
x
;
if
(
s
)
y
=
x
-
toint
+
toint
;
y
=
fp_barrier
(
x
-
toint
)
+
toint
;
else
y
=
x
+
toint
-
toint
;
y
=
fp_barrier
(
x
+
toint
)
-
toint
;
if
(
y
==
0
)
return
s
?
-
0
.
0
:
0
;
return
y
;
...
...
libs/musl/src/math/rintf.c
View file @
554e7aee
...
...
@@ -22,9 +22,9 @@ float __cdecl rintf(float x)
if
(
e
>=
0x7f
+
23
)
return
x
;
if
(
s
)
y
=
x
-
toint
+
toint
;
y
=
fp_barrierf
(
x
-
toint
)
+
toint
;
else
y
=
x
+
toint
-
toint
;
y
=
fp_barrierf
(
x
+
toint
)
-
toint
;
if
(
y
==
0
)
return
s
?
-
0
.
0
f
:
0
.
0
f
;
return
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