Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
Zwinkau
libfirm
Commits
e2b20d37
Commit
e2b20d37
authored
Apr 26, 2007
by
Michael Beck
Browse files
Typo fixed
[r13502]
parent
040ff4a4
Changes
1
Hide whitespace changes
Inline
Side-by-side
ir/adt/unionfind.h
View file @
e2b20d37
...
...
@@ -38,11 +38,10 @@
* union find functions.
*
* @param data The array (you have to allocate it yourself)
* @param from The first element that should be intialized
* @param from The first element that should be in
i
tialized
* @param to the index of the first element which is not initialized anymore
*/
static
INLINE
void
uf_init
(
int
*
data
,
int
from
,
int
to
)
{
static
INLINE
void
uf_init
(
int
*
data
,
int
from
,
int
to
)
{
int
i
;
for
(
i
=
from
;
i
<
to
;
++
i
)
{
data
[
i
]
=
-
1
;
...
...
@@ -67,7 +66,7 @@ static INLINE int uf_union(int* data, int set1, int set2) {
if
(
set1
==
set2
)
return
0
;
/
/
need 2 set representatives
/
*
need 2 set representatives
*/
assert
(
d1
<
0
&&
d2
<
0
);
newcount
=
d1
+
d2
;
...
...
@@ -93,13 +92,13 @@ static INLINE int uf_union(int* data, int set1, int set2) {
* @return The representative of the set that contains @p e
*/
static
INLINE
int
uf_find
(
int
*
data
,
int
e
)
{
/
/
go through list to find representative
int
repr
=
e
;
/
*
go through list to find representative
*/
int
repr
=
e
;
while
(
data
[
repr
]
>=
0
)
{
repr
=
data
[
repr
];
}
/
/
update list to point to new representative (path compression)
/
*
update list to point to new representative (path compression)
*/
while
(
e
!=
repr
)
{
int
next
=
data
[
e
];
data
[
e
]
=
repr
;
...
...
@@ -109,4 +108,4 @@ static INLINE int uf_find(int* data, int e) {
return
repr
;
}
#endif
#endif
/* FIRM_ADT_UNIONFIND_H */
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