summaryrefslogtreecommitdiffstats
path: root/generic
diff options
context:
space:
mode:
authorMiguel Sofer <miguel.sofer@gmail.com>2007-08-19 22:50:03 (GMT)
committerMiguel Sofer <miguel.sofer@gmail.com>2007-08-19 22:50:03 (GMT)
commita7fd173f41040ffdcd5acefcf5e8965d1250d8c7 (patch)
treed265ba904dd0ce2c92e95a20d8a37ac77df83bc8 /generic
parentcf8817bf14fed111b4cec85395a921345dfc0fdc (diff)
downloadtcl-a7fd173f41040ffdcd5acefcf5e8965d1250d8c7.zip
tcl-a7fd173f41040ffdcd5acefcf5e8965d1250d8c7.tar.gz
tcl-a7fd173f41040ffdcd5acefcf5e8965d1250d8c7.tar.bz2
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].
Diffstat (limited to 'generic')
-rw-r--r--generic/tclExecute.c7
1 files 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