The tpRunCycle() function

More
27 Feb 2022 12:28 #235906 by veknic
The tpRunCycle() function was created by veknic
The member 'reverse_run ' is indicated that the tp runs reverse, but look at followings, the tcqItem() function just ignore "n < 0", so how is it can run reverse ?

/* Get pointers to current and relevant future segments. It's ok here if
* future segments don't exist (NULL pointers) as we check for this later).
*/

int queue_dir_step = tp->reverse_run ? -1 : 1;
tc = tcqItem(&tp->queue, 0);
nexttc = tcqItem(&tp->queue, queue_dir_step * 1);
/* gets the n-th TC element in the queue, without removing it */TC_STRUCT * tcqItem(TC_QUEUE_STRUCT const * const tcq, int n)
{
if (tcqCheck(tcq) || (n < 0) || (n >= tcq->_len)) return NULL;

return &(tcq->queue[(tcq->start + n) % tcq->size]);
}
 

Please Log in or Create an account to join the conversation.

More
28 Feb 2022 23:08 #236067 by andypugh
Replied by andypugh on topic The tpRunCycle() function
Isn't n the segment number, so each segment has a postive serial number, and reverse run counts down rather than up?

Please Log in or Create an account to join the conversation.

Time to create page: 0.057 seconds
Powered by Kunena Forum