Another try:
void applyThingy(int *grid, int xPitch, int yPitch)
{
int row, column;
int *rowPointer = grid;
for(row = 0; row < 3; ++row)
{
int *columnPointer = rowPointer;
for(column = 0; column < 3; ++column)
{
doOperation(columnPointer);
columnPointer += xPitch;
}
rowPointer += yPitch * 9;
}
}
applyThingy(&grid[SUB(n)], 1, 1); // Perform on 3x3 subgrid
applyThingy(&grid[ROW(n)], 1, 0); // Perform on row
applyThingy(&grid[COL(n)], 0, 1); // Perform on column
strager
2009-03-13 01:00:36