Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
R
riscv-gcc-1
Overview
Overview
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
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
lvzhengyang
riscv-gcc-1
Commits
7bc7d45a
Commit
7bc7d45a
authored
Jan 07, 1993
by
Torbjorn Granlund
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
(__udiv_w_sdiv): Replace hard-coded constants 31 with (SI_TYPE_SIZE - 1).
From-SVN: r3146
parent
1d01c176
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
4 additions
and
4 deletions
+4
-4
gcc/libgcc2.c
+4
-4
No files found.
gcc/libgcc2.c
View file @
7bc7d45a
...
@@ -284,7 +284,7 @@ __udiv_w_sdiv (rp, a1, a0, d)
...
@@ -284,7 +284,7 @@ __udiv_w_sdiv (rp, a1, a0, d)
if
((
SItype
)
d
>=
0
)
if
((
SItype
)
d
>=
0
)
{
{
if
(
a1
<
d
-
a1
-
(
a0
>>
31
))
if
(
a1
<
d
-
a1
-
(
a0
>>
(
SI_TYPE_SIZE
-
1
)
))
{
{
/* dividend, divisor, and quotient are nonnegative */
/* dividend, divisor, and quotient are nonnegative */
sdiv_qrnnd
(
q
,
r
,
a1
,
a0
,
d
);
sdiv_qrnnd
(
q
,
r
,
a1
,
a0
,
d
);
...
@@ -292,18 +292,18 @@ __udiv_w_sdiv (rp, a1, a0, d)
...
@@ -292,18 +292,18 @@ __udiv_w_sdiv (rp, a1, a0, d)
else
else
{
{
/* Compute c1*2^32 + c0 = a1*2^32 + a0 - 2^31*d */
/* Compute c1*2^32 + c0 = a1*2^32 + a0 - 2^31*d */
sub_ddmmss
(
c1
,
c0
,
a1
,
a0
,
d
>>
1
,
d
<<
31
);
sub_ddmmss
(
c1
,
c0
,
a1
,
a0
,
d
>>
1
,
d
<<
(
SI_TYPE_SIZE
-
1
)
);
/* Divide (c1*2^32 + c0) by d */
/* Divide (c1*2^32 + c0) by d */
sdiv_qrnnd
(
q
,
r
,
c1
,
c0
,
d
);
sdiv_qrnnd
(
q
,
r
,
c1
,
c0
,
d
);
/* Add 2^31 to quotient */
/* Add 2^31 to quotient */
q
+=
(
USItype
)
1
<<
31
;
q
+=
(
USItype
)
1
<<
(
SI_TYPE_SIZE
-
1
)
;
}
}
}
}
else
else
{
{
b1
=
d
>>
1
;
/* d/2, between 2^30 and 2^31 - 1 */
b1
=
d
>>
1
;
/* d/2, between 2^30 and 2^31 - 1 */
c1
=
a1
>>
1
;
/* A/2 */
c1
=
a1
>>
1
;
/* A/2 */
c0
=
(
a1
<<
31
)
+
(
a0
>>
1
);
c0
=
(
a1
<<
(
SI_TYPE_SIZE
-
1
)
)
+
(
a0
>>
1
);
if
(
a1
<
b1
)
/* A < 2^32*b1, so A/2 < 2^31*b1 */
if
(
a1
<
b1
)
/* A < 2^32*b1, so A/2 < 2^31*b1 */
{
{
...
...
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