28 #define FXU_HEAP_SINGLE_WEIGHT(pSingle) ((pSingle)->Weight)
29 #define FXU_HEAP_SINGLE_CURRENT(p, pSingle) ((p)->pTree[(pSingle)->HNum])
30 #define FXU_HEAP_SINGLE_PARENT_EXISTS(p, pSingle) ((pSingle)->HNum > 1)
31 #define FXU_HEAP_SINGLE_CHILD1_EXISTS(p, pSingle) (((pSingle)->HNum << 1) <= p->nItems)
32 #define FXU_HEAP_SINGLE_CHILD2_EXISTS(p, pSingle) ((((pSingle)->HNum << 1)+1) <= p->nItems)
33 #define FXU_HEAP_SINGLE_PARENT(p, pSingle) ((p)->pTree[(pSingle)->HNum >> 1])
34 #define FXU_HEAP_SINGLE_CHILD1(p, pSingle) ((p)->pTree[(pSingle)->HNum << 1])
35 #define FXU_HEAP_SINGLE_CHILD2(p, pSingle) ((p)->pTree[((pSingle)->HNum << 1)+1])
36 #define FXU_HEAP_SINGLE_ASSERT(p, pSingle) assert( (pSingle)->HNum >= 1 && (pSingle)->HNum <= p->nItemsAlloc )
127 fprintf( pFile,
"The contents of the heap:\n" );
128 fprintf( pFile,
"Level %d: ", Degree );
133 if ( ++Counter == (1 << Degree) )
135 fprintf( pFile,
"\n" );
137 fprintf( pFile,
"Level %d: ", Degree );
140 fprintf( pFile,
"\n" );
141 fprintf( pFile,
"End of the heap printout.\n" );
178 int Weight1, Weight2;
183 assert( Weight1 >= Weight2 );
189 assert( Weight1 >= Weight2 );
253 int Place = pSingle->
HNum;
299 pSingle = p->
pTree[1];
346 *pSingle1 = *pSingle2;
348 Temp = (*pSingle1)->
HNum;
349 (*pSingle1)->HNum = (*pSingle2)->HNum;
350 (*pSingle2)->HNum = Temp;
394 Fxu_Single ** ppChild1, ** ppChild2, ** ppSingle;
void Fxu_HeapSingleInsert(Fxu_HeapSingle *p, Fxu_Single *pSingle)
static void Fxu_HeapSingleMoveUp(Fxu_HeapSingle *p, Fxu_Single *pSingle)
#define FXU_HEAP_SINGLE_CHILD2_EXISTS(p, pSingle)
#define FXU_HEAP_SINGLE_PARENT(p, pSingle)
Fxu_HeapSingle * Fxu_HeapSingleStart()
FUNCTION DEFINITIONS ///.
#define FXU_HEAP_SINGLE_CURRENT(p, pSingle)
#define ABC_REALLOC(type, obj, num)
void Fxu_HeapSingleCheck(Fxu_HeapSingle *p)
#define FXU_HEAP_SINGLE_CHILD1_EXISTS(p, pSingle)
Fxu_Single * Fxu_HeapSingleGetMax(Fxu_HeapSingle *p)
static void Fxu_HeapSingleMoveDn(Fxu_HeapSingle *p, Fxu_Single *pSingle)
#define ABC_ALLOC(type, num)
void Fxu_HeapSingleStop(Fxu_HeapSingle *p)
#define FXU_HEAP_SINGLE_WEIGHT(pSingle)
DECLARATIONS ///.
#define Fxu_HeapSingleForEachItem(Heap, Single)
#define ABC_NAMESPACE_IMPL_END
#define ABC_NAMESPACE_IMPL_START
#define FXU_HEAP_SINGLE_PARENT_EXISTS(p, pSingle)
static void Fxu_HeapSingleSwap(Fxu_Single **pSingle1, Fxu_Single **pSingle2)
static void Fxu_HeapSingleResize(Fxu_HeapSingle *p)
void Fxu_HeapSingleUpdate(Fxu_HeapSingle *p, Fxu_Single *pSingle)
Fxu_Single * Fxu_HeapSingleReadMax(Fxu_HeapSingle *p)
void Fxu_HeapSinglePrint(FILE *pFile, Fxu_HeapSingle *p)
int Fxu_HeapSingleReadMaxWeight(Fxu_HeapSingle *p)
#define FXU_HEAP_SINGLE_CHILD1(p, pSingle)
void Fxu_HeapSingleCheckOne(Fxu_HeapSingle *p, Fxu_Single *pSingle)
#define FXU_HEAP_SINGLE_ASSERT(p, pSingle)
#define FXU_HEAP_SINGLE_CHILD2(p, pSingle)
void Fxu_HeapSingleDelete(Fxu_HeapSingle *p, Fxu_Single *pSingle)