Commit 6d122095 authored by Poul-Henning Kamp's avatar Poul-Henning Kamp

Fix the Parent calculation


git-svn-id: http://www.varnish-cache.org/svn/trunk/varnish-cache@493 d4fa192b-c00b-0410-8231-f00ffab90ce4
parent 00d53ca8
......@@ -33,7 +33,7 @@ struct binheap {
unsigned granularity;
};
#define PARENT(u) (((u) - 1) / 2)
#define PARENT(u) ((u) / 2)
#define CHILD(u,n) ((u) * 2 + (n))
/* Implementation ----------------------------------------------------*/
......@@ -43,6 +43,7 @@ binheap_update(struct binheap *bh, unsigned u)
{
assert(bh->magic == BINHEAP_MAGIC);
assert(u < bh->next);
assert(bh->array[u] != NULL);
if (bh->update == NULL)
return;
bh->update(bh->priv, bh->array[u], u);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment