private void GetNextChangingElement(int a0, bool isWhite, int[] ret)
{
// Local copies of instance variables
int[] pce = this.prevChangingElems;
int ces = this.changingElemSize;
// If the previous match was at an odd element, we still
// have to search the preceeding element.
// int start = lastChangingElement & ~0x1;
int start = lastChangingElement > 0 ? lastChangingElement - 1 : 0;
if (isWhite) {
start &= ~0x1; // Search even numbered elements
} else {
start |= 0x1; // Search odd numbered elements
}
int i = start;
for (; i < ces; i += 2) {
int temp = pce[i];
if (temp > a0) {
lastChangingElement = i;
ret[0] = temp;
break;
}
}
if (i + 1 < ces) {
ret[1] = pce[i + 1];
}
}