From: kim Date: Tue, 14 Feb 2012 09:26:36 +0000 (+0000) Subject: Changes == 0 to <= 0 for node id test X-Git-Url: http://git.nguyen.vg/gitweb/?p=SXSI%2Flibbp.git;a=commitdiff_plain;h=5979c34ae2455997903c8b2cc43a53f4cc13353c Changes == 0 to <= 0 for node id test * negative node-ids are special values that denote dummy nodes or errors, since valide nodes are positive, refusing the root with <= 0 rather than == 0 tells the compiler that the value of the id is (strictly) positive in the subsequent code, allowing the compiler to perform more agressive optimisations. git-svn-id: svn+ssh://idea.nguyen.vg/svn/sxsi/trunk/bp@1219 3cdefd35-fc62-479d-8e8d-bae585ffb9ca --- diff --git a/bp-darray.c b/bp-darray.c index ff781ec..a4aec4b 100644 --- a/bp-darray.c +++ b/bp-darray.c @@ -441,13 +441,7 @@ int bp_darray_select(darray *da, int i,int f) pb x; pb *q; - if (i == 0) return -1; - - if (i > da->m) { - return -1; - //printf("ERROR: m=%d i=%d\n",da->m,i); - //exit(1); - } + if (i <= 0 || i > da->m) return -1; i--;