It seems that the code deals with a circular queue. This expression
pu-rear = (pu->rear + 1) % pu->size
determines the index pu-rear in the array pu->queue where a new data will be written.
For example if you have an array declared like
T a[2];
and the initial index i equal to -1 then the first element will be written at the position ( i + 1 ) % 2 that is at the position 0.
The next element when i is equal to 0 (after the previous operation) will be written at the position ( i + 1 ) % 2 that is at the position 1.
The third element when i is equal to 1 will be written again at the position 0
( i + 1 ) % 2 == ( 1 + 1 ) % 2 == 0
That is when the end of the array is reached new elements are added at the array beginning anew.
To make it more clear consider the following demonstrative program.
#include <stdio.h>
int main(void)
{
enum { N = 3 };
int a[N];
int i = -1;
for ( int value = 0; value < 10; ++value )
{
a[ i = ( i + 1 ) % N ] = value;
printf( "i = %d, a[%d] = %d\n", i, i, a[i] );
}
return 0;
}
Its output is
i = 0, a[0] = 0
i = 1, a[1] = 1
i = 2, a[2] = 2
i = 0, a[0] = 3
i = 1, a[1] = 4
i = 2, a[2] = 5
i = 0, a[0] = 6
i = 1, a[1] = 7
i = 2, a[2] = 8
i = 0, a[0] = 9