fix cparser warnings
[libfirm] / include / libfirm / adt / unionfind.h
index f2ee4cd..13c70ca 100644 (file)
@@ -22,7 +22,7 @@
  * @brief      Union-Find datastructure
  * @author     Matthias Braun
  * @version    $Id$
- * @summary
+ * @brief
  *  Union-Find datastructure
  *
  *  This implementation uses weighted sets and path compression which results
@@ -33,6 +33,8 @@
 
 #include <assert.h>
 
+#include "../begin.h"
+
 /**
  * Call this to initialize an array of @p count elements to be used by the
  * union find functions.
@@ -52,11 +54,10 @@ static inline void uf_init(int* data, size_t n_elems)
  * Merge 2 sets (union operation). Note that you have to pass the
  * representatives of the sets and not just random elements
  *
- * @param data The union find data
- * @param set1 Representative of set1
- * @param set2 Representative of set2
- * @return             0 if the new union set is represented by set1, 1 if it is
- *              represented by set2
+ * @param data  The union find data
+ * @param set1  Representative of set1
+ * @param set2  Representative of set2
+ * @return      the new representative of the set (which is set1 or set2)
  */
 static inline int uf_union(int* data, int set1, int set2)
 {
@@ -65,7 +66,7 @@ static inline int uf_union(int* data, int set1, int set2)
        int newcount;
 
        if(set1 == set2)
-               return 0;
+               return set1;
 
        /* need 2 set representatives */
        d1 = data[set1];
@@ -76,11 +77,11 @@ static inline int uf_union(int* data, int set1, int set2)
        if(d1 > d2) {
                data[set1] = set2;
                data[set2] = newcount;
-               return 1;
+               return set2;
        } else {
                data[set2] = set1;
                data[set1] = newcount;
-               return 0;
+               return set1;
        }
 }
 
@@ -90,9 +91,9 @@ static inline int uf_union(int* data, int set1, int set2)
  * the same/different representatives, then the elements are in the
  * the same/different sets.
  *
- * @param data The union find data
- * @param e            The element
- * @return             The representative of the set that contains @p e
+ * @param data  The union find data
+ * @param e     The element
+ * @return      The representative of the set that contains @p e
  */
 static inline int uf_find(int* data, int e)
 {
@@ -112,4 +113,6 @@ static inline int uf_find(int* data, int e)
        return repr;
 }
 
+#include "../end.h"
+
 #endif