Lines Matching defs:aHeap
78964 ** aHeap[0] is the number of elements on the heap. aHeap[1] is the
78965 ** root element. The daughter nodes of aHeap[N] are aHeap[N*2]
78966 ** and aHeap[N*2+1].
78970 ** root node aHeap[1] is always the minimum value currently in the heap.
78983 static void btreeHeapInsert(u32 *aHeap, u32 x){
78984 u32 j, i = ++aHeap[0];
78985 aHeap[i] = x;
78986 while( (j = i/2)>0 && aHeap[j]>aHeap[i] ){
78987 x = aHeap[j];
78988 aHeap[j] = aHeap[i];
78989 aHeap[i] = x;
78993 static int btreeHeapPull(u32 *aHeap, u32 *pOut){
78995 if( (x = aHeap[0])==0 ) return 0;
78996 *pOut = aHeap[1];
78997 aHeap[1] = aHeap[x];
78998 aHeap[x] = 0xffffffff;
78999 aHeap[0]--;
79001 while( (j = i*2)<=aHeap[0] ){
79002 if( aHeap[j]>aHeap[j+1] ) j++;
79003 if( aHeap[i]<aHeap[j] ) break;
79004 x = aHeap[i];
79005 aHeap[i] = aHeap[j];
79006 aHeap[j] = x;