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
f27f2d4e
Commit
f27f2d4e
authored
Apr 03, 2023
by
Alexandre Julliard
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
msvcrt: Use the remquo()/remquof() implementation from the bundled musl library.
parent
1cff65b6
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
4 additions
and
169 deletions
+4
-169
math.c
dlls/msvcrt/math.c
+0
-169
remquo.c
libs/musl/src/math/remquo.c
+2
-0
remquof.c
libs/musl/src/math/remquof.c
+2
-0
No files found.
dlls/msvcrt/math.c
View file @
f27f2d4e
...
...
@@ -8994,175 +8994,6 @@ float CDECL remainderf(float x, float y)
return
remquof
(
x
,
y
,
&
q
);
}
/*********************************************************************
* remquo (MSVCR120.@)
*
* Copied from musl: src/math/remquo.c
*/
double
CDECL
remquo
(
double
x
,
double
y
,
int
*
quo
)
{
UINT64
uxi
=
*
(
UINT64
*
)
&
x
;
UINT64
uyi
=
*
(
UINT64
*
)
&
y
;
int
ex
=
uxi
>>
52
&
0x7ff
;
int
ey
=
uyi
>>
52
&
0x7ff
;
int
sx
=
uxi
>>
63
;
int
sy
=
uyi
>>
63
;
UINT32
q
;
UINT64
i
;
*
quo
=
0
;
if
(
y
==
0
||
isinf
(
x
))
*
_errno
()
=
EDOM
;
if
(
uyi
<<
1
==
0
||
isnan
(
y
)
||
ex
==
0x7ff
)
return
(
x
*
y
)
/
(
x
*
y
);
if
(
uxi
<<
1
==
0
)
return
x
;
/* normalize x and y */
if
(
!
ex
)
{
for
(
i
=
uxi
<<
12
;
i
>>
63
==
0
;
ex
--
,
i
<<=
1
);
uxi
<<=
-
ex
+
1
;
}
else
{
uxi
&=
-
1ULL
>>
12
;
uxi
|=
1ULL
<<
52
;
}
if
(
!
ey
)
{
for
(
i
=
uyi
<<
12
;
i
>>
63
==
0
;
ey
--
,
i
<<=
1
);
uyi
<<=
-
ey
+
1
;
}
else
{
uyi
&=
-
1ULL
>>
12
;
uyi
|=
1ULL
<<
52
;
}
q
=
0
;
if
(
ex
<
ey
)
{
if
(
ex
+
1
==
ey
)
goto
end
;
return
x
;
}
/* x mod y */
for
(;
ex
>
ey
;
ex
--
)
{
i
=
uxi
-
uyi
;
if
(
i
>>
63
==
0
)
{
uxi
=
i
;
q
++
;
}
uxi
<<=
1
;
q
<<=
1
;
}
i
=
uxi
-
uyi
;
if
(
i
>>
63
==
0
)
{
uxi
=
i
;
q
++
;
}
if
(
uxi
==
0
)
ex
=
-
60
;
else
for
(;
uxi
>>
52
==
0
;
uxi
<<=
1
,
ex
--
);
end:
/* scale result and decide between |x| and |x|-|y| */
if
(
ex
>
0
)
{
uxi
-=
1ULL
<<
52
;
uxi
|=
(
UINT64
)
ex
<<
52
;
}
else
{
uxi
>>=
-
ex
+
1
;
}
x
=
*
(
double
*
)
&
uxi
;
if
(
sy
)
y
=
-
y
;
if
(
ex
==
ey
||
(
ex
+
1
==
ey
&&
(
2
*
x
>
y
||
(
2
*
x
==
y
&&
q
%
2
))))
{
x
-=
y
;
q
++
;
}
q
&=
0x7fffffff
;
*
quo
=
sx
^
sy
?
-
(
int
)
q
:
(
int
)
q
;
return
sx
?
-
x
:
x
;
}
/*********************************************************************
* remquof (MSVCR120.@)
*
* Copied from musl: src/math/remquof.c
*/
float
CDECL
remquof
(
float
x
,
float
y
,
int
*
quo
)
{
UINT32
uxi
=
*
(
UINT32
*
)
&
x
;
UINT32
uyi
=
*
(
UINT32
*
)
&
y
;
int
ex
=
uxi
>>
23
&
0xff
;
int
ey
=
uyi
>>
23
&
0xff
;
int
sx
=
uxi
>>
31
;
int
sy
=
uyi
>>
31
;
UINT32
q
,
i
;
*
quo
=
0
;
if
(
y
==
0
||
isinf
(
x
))
*
_errno
()
=
EDOM
;
if
(
uyi
<<
1
==
0
||
isnan
(
y
)
||
ex
==
0xff
)
return
(
x
*
y
)
/
(
x
*
y
);
if
(
uxi
<<
1
==
0
)
return
x
;
/* normalize x and y */
if
(
!
ex
)
{
for
(
i
=
uxi
<<
9
;
i
>>
31
==
0
;
ex
--
,
i
<<=
1
);
uxi
<<=
-
ex
+
1
;
}
else
{
uxi
&=
-
1U
>>
9
;
uxi
|=
1U
<<
23
;
}
if
(
!
ey
)
{
for
(
i
=
uyi
<<
9
;
i
>>
31
==
0
;
ey
--
,
i
<<=
1
);
uyi
<<=
-
ey
+
1
;
}
else
{
uyi
&=
-
1U
>>
9
;
uyi
|=
1U
<<
23
;
}
q
=
0
;
if
(
ex
<
ey
)
{
if
(
ex
+
1
==
ey
)
goto
end
;
return
x
;
}
/* x mod y */
for
(;
ex
>
ey
;
ex
--
)
{
i
=
uxi
-
uyi
;
if
(
i
>>
31
==
0
)
{
uxi
=
i
;
q
++
;
}
uxi
<<=
1
;
q
<<=
1
;
}
i
=
uxi
-
uyi
;
if
(
i
>>
31
==
0
)
{
uxi
=
i
;
q
++
;
}
if
(
uxi
==
0
)
ex
=
-
30
;
else
for
(;
uxi
>>
23
==
0
;
uxi
<<=
1
,
ex
--
);
end:
/* scale result and decide between |x| and |x|-|y| */
if
(
ex
>
0
)
{
uxi
-=
1U
<<
23
;
uxi
|=
(
UINT32
)
ex
<<
23
;
}
else
{
uxi
>>=
-
ex
+
1
;
}
x
=
*
(
float
*
)
&
uxi
;
if
(
sy
)
y
=
-
y
;
if
(
ex
==
ey
||
(
ex
+
1
==
ey
&&
(
2
*
x
>
y
||
(
2
*
x
==
y
&&
q
%
2
))))
{
x
-=
y
;
q
++
;
}
q
&=
0x7fffffff
;
*
quo
=
sx
^
sy
?
-
(
int
)
q
:
(
int
)
q
;
return
sx
?
-
x
:
x
;
}
/* sin(pi*x) assuming x > 2^-100, if sin(pi*x)==0 the sign is arbitrary */
static
double
sin_pi
(
double
x
)
{
...
...
libs/musl/src/math/remquo.c
View file @
f27f2d4e
#include <math.h>
#include <stdint.h>
#include "libm.h"
double
__cdecl
remquo
(
double
x
,
double
y
,
int
*
quo
)
{
...
...
@@ -13,6 +14,7 @@ double __cdecl remquo(double x, double y, int *quo)
uint64_t
uxi
=
ux
.
i
;
*
quo
=
0
;
if
(
y
==
0
||
isinf
(
x
))
errno
=
EDOM
;
if
(
uy
.
i
<<
1
==
0
||
isnan
(
y
)
||
ex
==
0x7ff
)
return
(
x
*
y
)
/
(
x
*
y
);
if
(
ux
.
i
<<
1
==
0
)
...
...
libs/musl/src/math/remquof.c
View file @
f27f2d4e
#include <math.h>
#include <stdint.h>
#include "libm.h"
float
__cdecl
remquof
(
float
x
,
float
y
,
int
*
quo
)
{
...
...
@@ -13,6 +14,7 @@ float __cdecl remquof(float x, float y, int *quo)
uint32_t
uxi
=
ux
.
i
;
*
quo
=
0
;
if
(
y
==
0
||
isinf
(
x
))
errno
=
EDOM
;
if
(
uy
.
i
<<
1
==
0
||
isnan
(
y
)
||
ex
==
0xff
)
return
(
x
*
y
)
/
(
x
*
y
);
if
(
ux
.
i
<<
1
==
0
)
...
...
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