From a7fd173f41040ffdcd5acefcf5e8965d1250d8c7 Mon Sep 17 00:00:00 2001 From: Miguel Sofer Date: Sun, 19 Aug 2007 22:50:03 +0000 Subject: Swapped the order in the Overflowing macro (created in the last commit by Donal): check first the condition most likely to fail in its usage by [incr]. --- generic/tclExecute.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/generic/tclExecute.c b/generic/tclExecute.c index a3d50a5..6bab480 100644 --- a/generic/tclExecute.c +++ b/generic/tclExecute.c @@ -12,7 +12,7 @@ * See the file "license.terms" for information on usage and redistribution of * this file, and for a DISCLAIMER OF ALL WARRANTIES. * - * RCS: @(#) $Id: tclExecute.c,v 1.317 2007/08/19 22:27:35 dkf Exp $ + * RCS: @(#) $Id: tclExecute.c,v 1.318 2007/08/19 22:50:03 msofer Exp $ */ #include "tclInt.h" @@ -427,9 +427,12 @@ VarHashCreateVar(TclVarHashTable *tablePtr, Tcl_Obj *key, int *newPtr) * "prototype" (where inttype_t is any integer type) is: * * MODULE_SCOPE int Overflowing(inttype_t a, inttype_t b, inttype_t sum); + * + * Check first the condition most likely to fail in usual code (at least for + * usage in [incr]: do the first summand and the sum have != signs? */ -#define Overflowing(a,b,sum) ((((a)^(b)) >= 0) && (((a)^(sum)) < 0)) +#define Overflowing(a,b,sum) ((((a)^(sum)) < 0) && (((a)^(b)) >= 0)) /* * Custom object type only used in this file; values of its type should never -- cgit v0.12