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
70bcaec7
Commit
70bcaec7
authored
Mar 30, 2023
by
Alexandre Julliard
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
msvcrt: Use the floor()/floorf() implementation from the bundled musl library.
With the changes from
29c07324
.
parent
9db27802
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
15 additions
and
73 deletions
+15
-73
math.c
dlls/msvcrt/math.c
+0
-58
floor.c
libs/musl/src/math/floor.c
+15
-15
No files found.
dlls/msvcrt/math.c
View file @
70bcaec7
...
...
@@ -1426,35 +1426,6 @@ float CDECL ceilf( float x )
return
u
.
f
;
}
/*********************************************************************
* floorf (MSVCRT.@)
*
* Copied from musl: src/math/floorf.c
*/
float
CDECL
floorf
(
float
x
)
{
union
{
float
f
;
UINT32
i
;}
u
=
{
x
};
int
e
=
(
int
)(
u
.
i
>>
23
&
0xff
)
-
0x7f
;
UINT32
m
;
if
(
e
>=
23
)
return
x
;
if
(
e
>=
0
)
{
m
=
0x007fffff
>>
e
;
if
((
u
.
i
&
m
)
==
0
)
return
x
;
if
(
u
.
i
>>
31
)
u
.
i
+=
m
;
u
.
i
&=
~
m
;
}
else
{
if
(
u
.
i
>>
31
==
0
)
return
0
;
else
if
(
u
.
i
<<
1
)
return
-
1
;
}
return
u
.
f
;
}
#endif
/*********************************************************************
...
...
@@ -3260,35 +3231,6 @@ double CDECL ceil( double x )
return
u
.
f
;
}
/*********************************************************************
* floor (MSVCRT.@)
*
* Based on musl: src/math/floorf.c
*/
double
CDECL
floor
(
double
x
)
{
union
{
double
f
;
UINT64
i
;}
u
=
{
x
};
int
e
=
(
int
)(
u
.
i
>>
52
&
0x7ff
)
-
0x3ff
;
UINT64
m
;
if
(
e
>=
52
)
return
x
;
if
(
e
>=
0
)
{
m
=
0x000fffffffffffffULL
>>
e
;
if
((
u
.
i
&
m
)
==
0
)
return
x
;
if
(
u
.
i
>>
63
)
u
.
i
+=
m
;
u
.
i
&=
~
m
;
}
else
{
if
(
u
.
i
>>
63
==
0
)
return
0
;
else
if
(
u
.
i
<<
1
)
return
-
1
;
}
return
u
.
f
;
}
#if defined(__i386__) || defined(__x86_64__)
static
void
_setfp_sse
(
unsigned
int
*
cw
,
unsigned
int
cw_mask
,
unsigned
int
*
sw
,
unsigned
int
sw_mask
)
...
...
libs/musl/src/math/floor.c
View file @
70bcaec7
...
...
@@ -5,27 +5,27 @@
#elif FLT_EVAL_METHOD==2
#define EPS LDBL_EPSILON
#endif
static
const
double_t
toint
=
1
/
EPS
;
double
__cdecl
floor
(
double
x
)
{
union
{
double
f
;
uint64_t
i
;}
u
=
{
x
};
int
e
=
u
.
i
>>
52
&
0x7
ff
;
int
e
=
(
u
.
i
>>
52
&
0x7ff
)
-
0x3
ff
;
double_t
y
;
if
(
e
>=
0x3ff
+
52
||
x
==
0
)
if
(
e
>=
52
)
return
x
;
/* y = int(x) - x, where int(x) is an integer neighbor of x */
if
(
u
.
i
>>
63
)
y
=
x
-
toint
+
toint
-
x
;
else
y
=
x
+
toint
-
toint
-
x
;
/* special case because of non-nearest rounding modes */
if
(
e
<=
0x3ff
-
1
)
{
FORCE_EVAL
(
y
);
return
u
.
i
>>
63
?
-
1
:
0
;
if
(
e
>=
0
)
{
uint64_t
m
=
0x000fffffffffffffULL
>>
e
;
if
((
u
.
i
&
m
)
==
0
)
return
x
;
if
(
u
.
i
>>
63
)
u
.
i
+=
m
;
u
.
i
&=
~
m
;
}
else
{
if
(
u
.
i
>>
63
==
0
)
return
0
;
if
(
u
.
i
<<
1
)
return
-
1
;
}
if
(
y
>
0
)
return
x
+
y
-
1
;
return
x
+
y
;
return
u
.
f
;
}
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