diff options
Diffstat (limited to 'kpat')
-rw-r--r-- | kpat/freecell-solver/pqueue.c | 12 | ||||
-rw-r--r-- | kpat/freecell-solver/pqueue.h | 8 |
2 files changed, 10 insertions, 10 deletions
diff --git a/kpat/freecell-solver/pqueue.c b/kpat/freecell-solver/pqueue.c index 0e4df49b..086cce96 100644 --- a/kpat/freecell-solver/pqueue.c +++ b/kpat/freecell-solver/pqueue.c @@ -82,17 +82,17 @@ int freecell_solver_PQueuePush( PQUEUE *pq, void *item, pq_rating_t r) { - while( ( i==PTQ_FIRST_ENTRY ? + while( ( i==PQ_FIRST_ENTRY ? (PQUEUE_MaxRating) /* return biggest possible rating if first element */ : - (PGetRating(Elements[ PTQ_PARENT_INDEX(i) ]) ) + (PGetRating(Elements[ PQ_PARENT_INDEX(i) ]) ) ) < r ) { - Elements[ i ] = Elements[ PTQ_PARENT_INDEX(i) ]; + Elements[ i ] = Elements[ PQ_PARENT_INDEX(i) ]; - i = PTQ_PARENT_INDEX(i); + i = PQ_PARENT_INDEX(i); } } @@ -132,7 +132,7 @@ void *freecell_solver_PQueuePop( PQUEUE *pq) return NULL; } - pMaxElement = Elements[PTQ_FIRST_ENTRY]; + pMaxElement = Elements[PQ_FIRST_ENTRY]; /* get pointer to last element in tree */ pLastElement = Elements[ CurrentSize-- ]; @@ -143,7 +143,7 @@ void *freecell_solver_PQueuePop( PQUEUE *pq) /* UNTESTED */ - for( i=PTQ_FIRST_ENTRY; (child = PTQ_LEFT_CHILD_INDEX(i)) <= CurrentSize; i=child ) + for( i=PQ_FIRST_ENTRY; (child = PQ_LEFT_CHILD_INDEX(i)) <= CurrentSize; i=child ) { /* set child to the smaller of the two children... */ diff --git a/kpat/freecell-solver/pqueue.h b/kpat/freecell-solver/pqueue.h index f74068a8..cf5f5372 100644 --- a/kpat/freecell-solver/pqueue.h +++ b/kpat/freecell-solver/pqueue.h @@ -44,12 +44,12 @@ typedef struct _PQUEUE a "sentinel" value at 0 these macros are useful in making the code clearer */ /* the parent is always given by index/2 */ -#define PTQ_PARENT_INDEX(i) ((i)>>1) -#define PTQ_FIRST_ENTRY (1) +#define PQ_PARENT_INDEX(i) ((i)>>1) +#define PQ_FIRST_ENTRY (1) /* left and right children are index * 2 and (index * 2) +1 respectively */ -#define PTQ_LEFT_CHILD_INDEX(i) ((i)<<1) -#define PTQ_RIGHT_CHILD_INDEX(i) (((i)<<1)+1) +#define PQ_LEFT_CHILD_INDEX(i) ((i)<<1) +#define PQ_RIGHT_CHILD_INDEX(i) (((i)<<1)+1) void freecell_solver_PQueueInitialise( PQUEUE *pq, |