fix uf_union if merging a set with itself
authorMatthias Braun <matze@braunis.de>
Tue, 29 Aug 2006 13:26:48 +0000 (13:26 +0000)
committerMatthias Braun <matze@braunis.de>
Tue, 29 Aug 2006 13:26:48 +0000 (13:26 +0000)
[r8139]

ir/adt/unionfind.h

index 055907d..9364d6b 100644 (file)
@@ -50,6 +50,9 @@ static INLINE int uf_union(int* data, int set1, int set2) {
        int d2 = data[set2];
        int newcount;
 
+       if(set1 == set2)
+               return 0;
+
        // need 2 set represantatives
        assert(d1 < 0 && d2 < 0);