pike.git / src / rbtree.c

version» Context lines:

pike.git/src/rbtree.c:1:   /*   || This file is part of Pike. For copyright information see COPYRIGHT.   || Pike is distributed under GPL, LGPL and MPL. See the file COPYING   || for more information. - || $Id: rbtree.c,v 1.16 2002/12/07 20:12:58 grubba Exp $ + || $Id: rbtree.c,v 1.17 2002/12/07 22:46:52 mast Exp $   */      /* An implementation of a threaded red/black balanced binary tree.    *    * Created 2001-04-27 by Martin Stjernholm <mast@lysator.liu.se>    */      #include "global.h"    - RCSID("$Id: rbtree.c,v 1.16 2002/12/07 20:12:58 grubba Exp $"); + RCSID("$Id: rbtree.c,v 1.17 2002/12/07 22:46:52 mast Exp $");      #include "interpret.h"   #include "pike_error.h"   #include "rbtree_low.h"      #include <assert.h>   #include <stdlib.h>      #if defined (PIKE_DEBUG) || defined (TEST_MULTISET)   
pike.git/src/rbtree.c:1431:    if (length > 1) {    unsigned depth, *top_idx;    size_t deep_end, count = 0, start = 0, idx = 1;    struct rb_node_hdr **stack, *prev_tgt = NULL, *next_src = NULL;    int stack_malloced = 0;       {    unsigned l = 0, h = sizeof (length) * CHAR_BIT;    do {    depth = (l + h) >> 1; -  if (1u << depth <= length) l = depth + 1; else h = depth; +  if ((size_t) 1 << depth <= length) +  l = depth + 1; +  else +  h = depth;    } while (l < h); -  if (1u << depth <= length) depth++; +  if ((size_t) 1 << depth <= length) depth++;    }       deep_end = (length - (1 << (depth - 1))) << 1;    if (!(length & 1)) deep_end |= 1;       {    size_t stack_size =    depth * sizeof (struct rb_node_hdr *) +    (depth + 1) * sizeof (unsigned);   #ifdef HAVE_ALLOCA