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
b5bc0267
Commit
b5bc0267
authored
Apr 04, 2023
by
Alexandre Julliard
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
msvcrt: Use the fmod()/fmodf() implementation from the bundled musl library.
parent
ec31d30e
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
5 additions
and
136 deletions
+5
-136
math.c
dlls/msvcrt/math.c
+0
-136
fmod.c
libs/musl/src/math/fmod.c
+3
-0
fmodf.c
libs/musl/src/math/fmodf.c
+2
-0
No files found.
dlls/msvcrt/math.c
View file @
b5bc0267
...
...
@@ -1085,74 +1085,6 @@ float CDECL expf( float x )
}
/*********************************************************************
* fmodf (MSVCRT.@)
*
* Copied from musl: src/math/fmodf.c
*/
float
CDECL
fmodf
(
float
x
,
float
y
)
{
UINT32
xi
=
*
(
UINT32
*
)
&
x
;
UINT32
yi
=
*
(
UINT32
*
)
&
y
;
int
ex
=
xi
>>
23
&
0xff
;
int
ey
=
yi
>>
23
&
0xff
;
UINT32
sx
=
xi
&
0x80000000
;
UINT32
i
;
if
(
isinf
(
x
))
return
math_error
(
_DOMAIN
,
"fmodf"
,
x
,
y
,
(
x
*
y
)
/
(
x
*
y
));
if
(
yi
<<
1
==
0
||
isnan
(
y
)
||
ex
==
0xff
)
return
(
x
*
y
)
/
(
x
*
y
);
if
(
xi
<<
1
<=
yi
<<
1
)
{
if
(
xi
<<
1
==
yi
<<
1
)
return
0
*
x
;
return
x
;
}
/* normalize x and y */
if
(
!
ex
)
{
for
(
i
=
xi
<<
9
;
i
>>
31
==
0
;
ex
--
,
i
<<=
1
);
xi
<<=
-
ex
+
1
;
}
else
{
xi
&=
-
1U
>>
9
;
xi
|=
1U
<<
23
;
}
if
(
!
ey
)
{
for
(
i
=
yi
<<
9
;
i
>>
31
==
0
;
ey
--
,
i
<<=
1
);
yi
<<=
-
ey
+
1
;
}
else
{
yi
&=
-
1U
>>
9
;
yi
|=
1U
<<
23
;
}
/* x mod y */
for
(;
ex
>
ey
;
ex
--
)
{
i
=
xi
-
yi
;
if
(
i
>>
31
==
0
)
{
if
(
i
==
0
)
return
0
*
x
;
xi
=
i
;
}
xi
<<=
1
;
}
i
=
xi
-
yi
;
if
(
i
>>
31
==
0
)
{
if
(
i
==
0
)
return
0
*
x
;
xi
=
i
;
}
for
(;
xi
>>
23
==
0
;
xi
<<=
1
,
ex
--
);
/* scale result up */
if
(
ex
>
0
)
{
xi
-=
1U
<<
23
;
xi
|=
(
UINT32
)
ex
<<
23
;
}
else
{
xi
>>=
-
ex
+
1
;
}
xi
|=
sx
;
return
*
(
float
*
)
&
xi
;
}
/*********************************************************************
* logf (MSVCRT.@)
*
* Copied from musl: src/math/logf.c src/math/logf_data.c
...
...
@@ -2749,74 +2681,6 @@ double CDECL exp( double x )
}
/*********************************************************************
* fmod (MSVCRT.@)
*
* Copied from musl: src/math/fmod.c
*/
double
CDECL
fmod
(
double
x
,
double
y
)
{
UINT64
xi
=
*
(
UINT64
*
)
&
x
;
UINT64
yi
=
*
(
UINT64
*
)
&
y
;
int
ex
=
xi
>>
52
&
0x7ff
;
int
ey
=
yi
>>
52
&
0x7ff
;
int
sx
=
xi
>>
63
;
UINT64
i
;
if
(
isinf
(
x
))
return
math_error
(
_DOMAIN
,
"fmod"
,
x
,
y
,
(
x
*
y
)
/
(
x
*
y
));
if
(
yi
<<
1
==
0
||
isnan
(
y
)
||
ex
==
0x7ff
)
return
(
x
*
y
)
/
(
x
*
y
);
if
(
xi
<<
1
<=
yi
<<
1
)
{
if
(
xi
<<
1
==
yi
<<
1
)
return
0
*
x
;
return
x
;
}
/* normalize x and y */
if
(
!
ex
)
{
for
(
i
=
xi
<<
12
;
i
>>
63
==
0
;
ex
--
,
i
<<=
1
);
xi
<<=
-
ex
+
1
;
}
else
{
xi
&=
-
1ULL
>>
12
;
xi
|=
1ULL
<<
52
;
}
if
(
!
ey
)
{
for
(
i
=
yi
<<
12
;
i
>>
63
==
0
;
ey
--
,
i
<<=
1
);
yi
<<=
-
ey
+
1
;
}
else
{
yi
&=
-
1ULL
>>
12
;
yi
|=
1ULL
<<
52
;
}
/* x mod y */
for
(;
ex
>
ey
;
ex
--
)
{
i
=
xi
-
yi
;
if
(
i
>>
63
==
0
)
{
if
(
i
==
0
)
return
0
*
x
;
xi
=
i
;
}
xi
<<=
1
;
}
i
=
xi
-
yi
;
if
(
i
>>
63
==
0
)
{
if
(
i
==
0
)
return
0
*
x
;
xi
=
i
;
}
for
(;
xi
>>
52
==
0
;
xi
<<=
1
,
ex
--
);
/* scale result */
if
(
ex
>
0
)
{
xi
-=
1ULL
<<
52
;
xi
|=
(
UINT64
)
ex
<<
52
;
}
else
{
xi
>>=
-
ex
+
1
;
}
xi
|=
(
UINT64
)
sx
<<
63
;
return
*
(
double
*
)
&
xi
;
}
/*********************************************************************
* log (MSVCRT.@)
*
* Copied from musl: src/math/log.c src/math/log_data.c
...
...
libs/musl/src/math/fmod.c
View file @
b5bc0267
#include <math.h>
#include <stdint.h>
#include "libm.h"
double
__cdecl
fmod
(
double
x
,
double
y
)
{
...
...
@@ -13,6 +14,8 @@ double __cdecl fmod(double x, double y)
/* float load/store to inner loops ruining performance and code size */
uint64_t
uxi
=
ux
.
i
;
if
(
isinf
(
x
))
return
math_error
(
_DOMAIN
,
"fmod"
,
x
,
y
,
(
x
*
y
)
/
(
x
*
y
));
if
(
uy
.
i
<<
1
==
0
||
isnan
(
y
)
||
ex
==
0x7ff
)
return
(
x
*
y
)
/
(
x
*
y
);
if
(
uxi
<<
1
<=
uy
.
i
<<
1
)
{
...
...
libs/musl/src/math/fmodf.c
View file @
b5bc0267
...
...
@@ -11,6 +11,8 @@ float __cdecl fmodf(float x, float y)
uint32_t
i
;
uint32_t
uxi
=
ux
.
i
;
if
(
isinf
(
x
))
return
math_error
(
_DOMAIN
,
"fmodf"
,
x
,
y
,
(
x
*
y
)
/
(
x
*
y
));
if
(
uy
.
i
<<
1
==
0
||
isnan
(
y
)
||
ex
==
0xff
)
return
(
x
*
y
)
/
(
x
*
y
);
if
(
uxi
<<
1
<=
uy
.
i
<<
1
)
{
...
...
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