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
ebea352b
Commit
ebea352b
authored
Aug 20, 1992
by
Richard Stallman
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
(not_qsort): New function.
From-SVN: r1914
parent
5ac3f0f4
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
89 additions
and
0 deletions
+89
-0
gcc/config/vax/vax.c
+89
-0
No files found.
gcc/config/vax/vax.c
View file @
ebea352b
...
...
@@ -577,3 +577,92 @@ vax_rtx_cost (x)
}
return
c
;
}
#ifdef VMS
/* Additional support code for VMS. */
#ifdef QSORT_WORKAROUND
/*
Do not use VAXCRTL's qsort() due to a severe bug: once you've
sorted something which has a size that's an exact multiple of 4
and is longword aligned, you cannot safely sort anything which
is either not a multiple of 4 in size or not longword aligned.
A static "move-by-longword" optimization flag inside qsort() is
never reset. This is known of affect VMS V4.6 through VMS V5.5-1.
In this work-around an insertion sort is used for simplicity.
The qsort code from glibc should probably be used instead.
*/
void
not_qsort
(
array
,
count
,
size
,
compare
)
void
*
array
;
unsigned
count
,
size
;
int
(
*
compare
)();
{
if
(
size
==
sizeof
(
short
))
{
register
int
i
;
register
short
*
next
,
*
prev
;
short
tmp
,
*
base
=
array
;
for
(
next
=
base
,
i
=
count
-
1
;
i
>
0
;
i
--
)
{
prev
=
next
++
;
if
((
*
compare
)(
next
,
prev
)
<
0
)
{
tmp
=
*
next
;
do
*
(
prev
+
1
)
=
*
prev
;
while
(
--
prev
>=
base
?
(
*
compare
)(
&
tmp
,
prev
)
<
0
:
0
);
*
(
prev
+
1
)
=
tmp
;
}
}
}
else
if
(
size
==
sizeof
(
long
))
{
register
int
i
;
register
long
*
next
,
*
prev
;
long
tmp
,
*
base
=
array
;
for
(
next
=
base
,
i
=
count
-
1
;
i
>
0
;
i
--
)
{
prev
=
next
++
;
if
((
*
compare
)(
next
,
prev
)
<
0
)
{
tmp
=
*
next
;
do
*
(
prev
+
1
)
=
*
prev
;
while
(
--
prev
>=
base
?
(
*
compare
)(
&
tmp
,
prev
)
<
0
:
0
);
*
(
prev
+
1
)
=
tmp
;
}
}
}
else
/* arbitrary size */
{
#ifdef USE_C_ALLOCA
extern
void
*
alloca
();
#endif
register
int
i
;
register
char
*
next
,
*
prev
,
*
tmp
=
alloca
(
size
),
*
base
=
array
;
for
(
next
=
base
,
i
=
count
-
1
;
i
>
0
;
i
--
)
{
/* count-1 forward iterations */
prev
=
next
,
next
+=
size
;
/* increment front pointer */
if
((
*
compare
)(
next
,
prev
)
<
0
)
{
/* found element out of order; move others up then re-insert */
memcpy
(
tmp
,
next
,
size
);
/* save smaller element */
do
{
memcpy
(
prev
+
size
,
prev
,
size
);
/* move larger elem. up */
prev
-=
size
;
/* decrement back pointer */
}
while
(
prev
>=
base
?
(
*
compare
)(
tmp
,
prev
)
<
0
:
0
);
memcpy
(
prev
+
size
,
tmp
,
size
);
/* restore small element */
}
}
#ifdef USE_C_ALLOCA
alloca
(
0
);
#endif
}
return
;
}
#endif
/* QSORT_WORKAROUND */
#endif
/* VMS */
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