From 0cb8393236b4b7b40059505f1e4fcf2d28183bc8 Mon Sep 17 00:00:00 2001 From: Sebastian Buchwald Date: Tue, 7 Oct 2008 12:26:31 +0000 Subject: [PATCH] Fixed r22565: we have signed values. [r22570] --- vector.c | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/vector.c b/vector.c index d0465de0c..0a36f594c 100644 --- a/vector.c +++ b/vector.c @@ -11,8 +11,15 @@ num pbqp_add(num x, num y) num res = x + y; - assert(res >= x); - assert(res >= 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; -- 2.20.1