The function CountMarkedCellsInRow counts all cells in the row Row whose cell state matches the bit mask parameter StateMask; i.e. a cell is counted as marked if a bitwise AND of the cell state and the StateMask parameter does not result in a zero value