This is a simple C calculation. The first one above doesn't roll over when FilterIndex is equal to FilterDepth. In other words, FilterDepth is 15, filterIndex becomes 15, once the cpu executes this, it should be 0, but it becomes 16 and later becomes 1, never 0.
If I break the logic into two, it works. What am I missing here?
filterIndex = ((filterIndex++) % FilterDepth) ;
vs.
filterIndex++;
filterIndex=filterIndex % FilterDepth;