28 #define FXU_HEAP_DOUBLE_WEIGHT(pDiv) ((pDiv)->Weight)
29 #define FXU_HEAP_DOUBLE_CURRENT(p, pDiv) ((p)->pTree[(pDiv)->HNum])
30 #define FXU_HEAP_DOUBLE_PARENT_EXISTS(p, pDiv) ((pDiv)->HNum > 1)
31 #define FXU_HEAP_DOUBLE_CHILD1_EXISTS(p, pDiv) (((pDiv)->HNum << 1) <= p->nItems)
32 #define FXU_HEAP_DOUBLE_CHILD2_EXISTS(p, pDiv) ((((pDiv)->HNum << 1)+1) <= p->nItems)
33 #define FXU_HEAP_DOUBLE_PARENT(p, pDiv) ((p)->pTree[(pDiv)->HNum >> 1])
34 #define FXU_HEAP_DOUBLE_CHILD1(p, pDiv) ((p)->pTree[(pDiv)->HNum << 1])
35 #define FXU_HEAP_DOUBLE_CHILD2(p, pDiv) ((p)->pTree[((pDiv)->HNum << 1)+1])
36 #define FXU_HEAP_DOUBLE_ASSERT(p, pDiv) assert( (pDiv)->HNum >= 1 && (pDiv)->HNum <= p->nItemsAlloc )
124 fprintf( pFile,
"The contents of the heap:\n" );
125 fprintf( pFile,
"Level %d: ", Degree );
130 if ( ++Counter == (1 << Degree) )
132 fprintf( pFile,
"\n" );
134 fprintf( pFile,
"Level %d: ", Degree );
137 fprintf( pFile,
"\n" );
138 fprintf( pFile,
"End of the heap printout.\n" );
175 int Weight1, Weight2;
180 assert( Weight1 >= Weight2 );
186 assert( Weight1 >= Weight2 );
347 Temp = (*pDiv1)->
HNum;
348 (*pDiv1)->HNum = (*pDiv2)->HNum;
349 (*pDiv2)->HNum = Temp;
393 Fxu_Double ** ppChild1, ** ppChild2, ** ppDiv;
Fxu_HeapDouble * Fxu_HeapDoubleStart()
FUNCTION DEFINITIONS ///.
Fxu_Double * Fxu_HeapDoubleReadMax(Fxu_HeapDouble *p)
#define FXU_HEAP_DOUBLE_CHILD2(p, pDiv)
#define FXU_HEAP_DOUBLE_WEIGHT(pDiv)
DECLARATIONS ///.
void Fxu_HeapDoubleDelete(Fxu_HeapDouble *p, Fxu_Double *pDiv)
#define ABC_REALLOC(type, obj, num)
static void Fxu_HeapDoubleMoveUp(Fxu_HeapDouble *p, Fxu_Double *pDiv)
void Fxu_HeapDoubleCheck(Fxu_HeapDouble *p)
#define ABC_ALLOC(type, num)
#define FXU_HEAP_DOUBLE_CHILD2_EXISTS(p, pDiv)
Fxu_Double * Fxu_HeapDoubleGetMax(Fxu_HeapDouble *p)
#define FXU_HEAP_DOUBLE_CURRENT(p, pDiv)
int Fxu_HeapDoubleReadMaxWeight(Fxu_HeapDouble *p)
#define Fxu_HeapDoubleForEachItem(Heap, Div)
void Fxu_HeapDoubleUpdate(Fxu_HeapDouble *p, Fxu_Double *pDiv)
void Fxu_HeapDoublePrint(FILE *pFile, Fxu_HeapDouble *p)
#define FXU_HEAP_DOUBLE_CHILD1(p, pDiv)
#define FXU_HEAP_DOUBLE_PARENT(p, pDiv)
#define ABC_NAMESPACE_IMPL_END
static void Fxu_HeapDoubleMoveDn(Fxu_HeapDouble *p, Fxu_Double *pDiv)
void Fxu_HeapDoubleStop(Fxu_HeapDouble *p)
void Fxu_HeapDoubleCheckOne(Fxu_HeapDouble *p, Fxu_Double *pDiv)
#define ABC_NAMESPACE_IMPL_START
#define FXU_HEAP_DOUBLE_PARENT_EXISTS(p, pDiv)
#define FXU_HEAP_DOUBLE_CHILD1_EXISTS(p, pDiv)
void Fxu_HeapDoubleInsert(Fxu_HeapDouble *p, Fxu_Double *pDiv)
static void Fxu_HeapDoubleResize(Fxu_HeapDouble *p)
static void Fxu_HeapDoubleSwap(Fxu_Double **pDiv1, Fxu_Double **pDiv2)
#define FXU_HEAP_DOUBLE_ASSERT(p, pDiv)