Use other mechanism to determine whether an edge is already copied or not.
[libfirm] / vector.c
index 4f8ce17..0a36f59 100644 (file)
--- a/vector.c
+++ b/vector.c
@@ -9,7 +9,20 @@ num pbqp_add(num x, num y)
 {
        if (x == INF_COSTS || y == INF_COSTS) return INF_COSTS;
 
-       return x + y;
+       num res = x + y;
+
+       /* No positive overflow. */
+       assert(x < 0 || y < 0 || res >= x);
+       assert(x < 0 || y < 0 || res >= y);
+
+       /* No negative overflow. */
+       assert(x > 0 || y > 0 || res <= x);
+       assert(x > 0 || y > 0 || res <= y);
+
+       /* Result is not infinity.*/
+       assert(res < INF_COSTS);
+
+       return res;
 }
 
 vector *vector_alloc(pbqp *pbqp, unsigned length)