Skip to content

Instantly share code, notes, and snippets.

@dyigitpolat
Created March 12, 2017 16:33
Show Gist options
  • Save dyigitpolat/8b0f343e74e5f7548aefb5c11e469026 to your computer and use it in GitHub Desktop.
Save dyigitpolat/8b0f343e74e5f7548aefb5c11e469026 to your computer and use it in GitHub Desktop.
int* getCaseArr( int* isFilled, int h, int w)
{
int* caseArr;
caseArr = (int*) malloc( h*w*sizeof(int));
for( int i = 0; i < h-1; i++)
{
for( int j = 0; j < w-1; j++)
caseArr[ i*w + j] = 0xFF & (isFilled[ (i+1)*w + j] |
isFilled[ (i+1)*w + j + 1] << 1 |
isFilled[ i*w + j + 1] << 2 |
isFilled[ i*w + j] << 3);
}
return caseArr;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment