Moog Crossbow GNAV540 User Manual
Page 119

GNAV540 User Manual
7430‐0808‐01 Rev. B
Page 119
secondIndex = (queue_ptr->front + index + 1) % MAXQUEUE;
word = (queue_ptr->entry(firstIndex) << 8) & 0xFF00;
word |= (0x00FF & queue_ptr->entry(secondIndex));
return
word;
}
/*******************************************************************************
* FUNCTION: Pop - discard item(s) from queue
* ARGUMENTS: queue_ptr is pointer to the queue
*
numToPop is number of items to discard
* RETURNS:
return the number of items discarded
*******************************************************************************/
int Pop(QUEUE_TYPE *queue_ptr, int numToPop)
{
int
i=0;
char
tempchar;
for(i=0; i<numToPop; i++)
{
if(!DeleteQueue(&tempchar,
queue_ptr))
{
break;
}
}
return
i;
}
/*******************************************************************************
* FUNCTION: Size
* ARGUMENTS: queue_ptr is pointer to the queue
* RETURNS:
return the number of items in the queue
*******************************************************************************/
int Size(QUEUE_TYPE *queue_ptr)
{
return
queue_ptr->count;
}
/*******************************************************************************
* FUNCTION: Empty
* ARGUMENTS: queue_ptr is pointer to the queue
* RETURNS:
return 1 if empty, 0 if not
*******************************************************************************/
int Empty(QUEUE_TYPE *queue_ptr)
{
return queue_ptr->count <= 0;
}
/*******************************************************************************
* FUNCTION: Full
* ARGUMENTS: queue_ptr is pointer to the queue
* RETURNS:
return 1 if full, 0 if not full
*******************************************************************************/
int Full(QUEUE_TYPE *queue_ptr)
{
return queue_ptr->count >= MAXQUEUE;
}