static void process(int p) { if(p == 81) { print_board(); return; } int y = div9(p); int x = p % 9; if(board.trace[p] & 512) { process(p + 1); return; } for(unsigned int v = 1; v != 512; v <<= 1) { unsigned int* cx = board.cols + x; unsigned int* cy = board.rows + y; if(*cx & v | *cy & v) continue; unsigned int* cb = &board.blocks[div3(y)][div3(x)]; if(*cb & v) continue; board.trace[p] = v; *cx |= v; *cy |= v; *cb |= v; process(p + 1); *cb ^= v; *cy ^= v; *cx ^= v; } }
static void split_into8( word r, word g, word b, int n, byte *inxs ) { byte inx; if ( n >= 9 ) { inx = takefrom8(div9(r), div9(g), div9(b)); b -= gbmrgb_8[inx].b; g -= gbmrgb_8[inx].g; r -= gbmrgb_8[inx].r; *inxs++ = inx; inx = takefrom8(div8(r), div8(g), div8(b)); b -= gbmrgb_8[inx].b; g -= gbmrgb_8[inx].g; r -= gbmrgb_8[inx].r; *inxs++ = inx; inx = takefrom8(div7(r), div7(g), div7(b)); b -= gbmrgb_8[inx].b; g -= gbmrgb_8[inx].g; r -= gbmrgb_8[inx].r; *inxs++ = inx; } if ( n >= 6 ) { inx = takefrom8(div6(r), div6(g), div6(b)); b -= gbmrgb_8[inx].b; g -= gbmrgb_8[inx].g; r -= gbmrgb_8[inx].r; *inxs++ = inx; inx = takefrom8(div5(r), div5(g), div5(b)); b -= gbmrgb_8[inx].b; g -= gbmrgb_8[inx].g; r -= gbmrgb_8[inx].r; *inxs++ = inx; } if ( n >= 4 ) { inx = takefrom8(div4(r), div4(g), div4(b)); b -= gbmrgb_8[inx].b; g -= gbmrgb_8[inx].g; r -= gbmrgb_8[inx].r; *inxs++ = inx; } if ( n >= 3 ) { inx = takefrom8(div3(r), div3(g), div3(b)); b -= gbmrgb_8[inx].b; g -= gbmrgb_8[inx].g; r -= gbmrgb_8[inx].r; *inxs++ = inx; } inx = takefrom8(div2(r), div2(g), div2(b)); b -= gbmrgb_8[inx].b; g -= gbmrgb_8[inx].g; r -= gbmrgb_8[inx].r; *inxs++ = inx; *inxs = takefrom8(r, g, b); }