diff options
Diffstat (limited to 'apps/plugins/sudoku')
-rw-r--r-- | apps/plugins/sudoku/generator.c | 4 | ||||
-rw-r--r-- | apps/plugins/sudoku/sudoku.c | 12 |
2 files changed, 8 insertions, 8 deletions
diff --git a/apps/plugins/sudoku/generator.c b/apps/plugins/sudoku/generator.c index 3d37bde22a..59bb9066cc 100644 --- a/apps/plugins/sudoku/generator.c +++ b/apps/plugins/sudoku/generator.c | |||
@@ -54,7 +54,7 @@ | |||
54 | 54 | ||
55 | #define STATE_MASK 0x0000ff80 | 55 | #define STATE_MASK 0x0000ff80 |
56 | #define STATE_SHIFT (7-1) /* digits 1..9 */ | 56 | #define STATE_SHIFT (7-1) /* digits 1..9 */ |
57 | #define DIGIT_STATE(digit) (1<<(STATE_SHIFT+(digit))) | 57 | #define DIGIT_STATE(digit) BIT_N(STATE_SHIFT+(digit)) |
58 | 58 | ||
59 | #define DIGIT_MASK 0x000f0000 | 59 | #define DIGIT_MASK 0x000f0000 |
60 | #define DIGIT_SHIFT 16 | 60 | #define DIGIT_SHIFT 16 |
@@ -266,7 +266,7 @@ numset( int mask ) | |||
266 | { | 266 | { |
267 | int i, n = 0; | 267 | int i, n = 0; |
268 | for( i = STATE_SHIFT + 1 ; i <= STATE_SHIFT + 9 ; ++i ) | 268 | for( i = STATE_SHIFT + 1 ; i <= STATE_SHIFT + 9 ; ++i ) |
269 | if( mask & (1<<i) ) | 269 | if( mask & BIT_N(i) ) |
270 | ++n; | 270 | ++n; |
271 | else | 271 | else |
272 | ++counts[ i - STATE_SHIFT - 1 ]; | 272 | ++counts[ i - STATE_SHIFT - 1 ]; |
diff --git a/apps/plugins/sudoku/sudoku.c b/apps/plugins/sudoku/sudoku.c index 69c41f476e..413be298ea 100644 --- a/apps/plugins/sudoku/sudoku.c +++ b/apps/plugins/sudoku/sudoku.c | |||
@@ -337,7 +337,7 @@ void sudoku_init(Sudoku* sud); | |||
337 | void sudoku_set(Sudoku* sud, int x, int y, int num, bool original); | 337 | void sudoku_set(Sudoku* sud, int x, int y, int num, bool original); |
338 | int sudoku_get(Sudoku* sud, int x, int y, bool* original); | 338 | int sudoku_get(Sudoku* sud, int x, int y, bool* original); |
339 | 339 | ||
340 | #define BIT(n) ((Bitset)(1<<(n))) | 340 | #define BIT(n) ((Bitset)BIT_N(n)) |
341 | #define BIT_TEST(v,n) ((((Bitset)v) & BIT(n)) != 0) | 341 | #define BIT_TEST(v,n) ((((Bitset)v) & BIT(n)) != 0) |
342 | #define BIT_CLEAR(v,n) (v) &= ~BIT(n) | 342 | #define BIT_CLEAR(v,n) (v) &= ~BIT(n) |
343 | #define MARK_BIT BIT(0) | 343 | #define MARK_BIT BIT(0) |
@@ -965,7 +965,7 @@ void display_board(struct sudoku_state_t* state) | |||
965 | rb->lcd_vline(XOFS+cellxpos[r]-2,YOFSSCRATCHPAD, | 965 | rb->lcd_vline(XOFS+cellxpos[r]-2,YOFSSCRATCHPAD, |
966 | YOFSSCRATCHPAD+CELL_HEIGHT+1); | 966 | YOFSSCRATCHPAD+CELL_HEIGHT+1); |
967 | #endif | 967 | #endif |
968 | if ((r>0) && state->possiblevals[state->y][state->x]&(1<<(r))) | 968 | if ((r>0) && state->possiblevals[state->y][state->x]&BIT_N(r)) |
969 | rb->lcd_bitmap_part(sudoku_normal,NUMBER_TYPE,BITMAP_HEIGHT*r, | 969 | rb->lcd_bitmap_part(sudoku_normal,NUMBER_TYPE,BITMAP_HEIGHT*r, |
970 | BITMAP_STRIDE,XOFS+cellxpos[r-1], | 970 | BITMAP_STRIDE,XOFS+cellxpos[r-1], |
971 | YOFSSCRATCHPAD+1,CELL_WIDTH,CELL_HEIGHT); | 971 | YOFSSCRATCHPAD+1,CELL_WIDTH,CELL_HEIGHT); |
@@ -976,7 +976,7 @@ void display_board(struct sudoku_state_t* state) | |||
976 | rb->lcd_vline(XOFS+cellxpos[8]+CELL_WIDTH+1,YOFSSCRATCHPAD, | 976 | rb->lcd_vline(XOFS+cellxpos[8]+CELL_WIDTH+1,YOFSSCRATCHPAD, |
977 | YOFSSCRATCHPAD+CELL_HEIGHT+1); | 977 | YOFSSCRATCHPAD+CELL_HEIGHT+1); |
978 | #endif | 978 | #endif |
979 | if (state->possiblevals[state->y][state->x]&(1<<(r))) | 979 | if (state->possiblevals[state->y][state->x]&BIT_N(r)) |
980 | rb->lcd_bitmap_part(sudoku_normal,NUMBER_TYPE,BITMAP_HEIGHT*r, | 980 | rb->lcd_bitmap_part(sudoku_normal,NUMBER_TYPE,BITMAP_HEIGHT*r, |
981 | BITMAP_STRIDE,XOFS+cellxpos[8],YOFSSCRATCHPAD+1, | 981 | BITMAP_STRIDE,XOFS+cellxpos[8],YOFSSCRATCHPAD+1, |
982 | CELL_WIDTH,CELL_HEIGHT); | 982 | CELL_WIDTH,CELL_HEIGHT); |
@@ -1004,7 +1004,7 @@ void display_board(struct sudoku_state_t* state) | |||
1004 | rb->lcd_hline(XOFSSCRATCHPAD,XOFSSCRATCHPAD+CELL_WIDTH+1, | 1004 | rb->lcd_hline(XOFSSCRATCHPAD,XOFSSCRATCHPAD+CELL_WIDTH+1, |
1005 | YOFS+cellypos[r]-2); | 1005 | YOFS+cellypos[r]-2); |
1006 | #endif | 1006 | #endif |
1007 | if ((r>0) && state->possiblevals[state->y][state->x]&(1<<(r))) | 1007 | if ((r>0) && state->possiblevals[state->y][state->x]&BIT_N(r)) |
1008 | rb->lcd_bitmap_part(sudoku_normal,NUMBER_TYPE,BITMAP_HEIGHT*r, | 1008 | rb->lcd_bitmap_part(sudoku_normal,NUMBER_TYPE,BITMAP_HEIGHT*r, |
1009 | BITMAP_STRIDE,XOFSSCRATCHPAD+1, | 1009 | BITMAP_STRIDE,XOFSSCRATCHPAD+1, |
1010 | YOFS+cellypos[r-1],CELL_WIDTH,CELL_HEIGHT); | 1010 | YOFS+cellypos[r-1],CELL_WIDTH,CELL_HEIGHT); |
@@ -1015,7 +1015,7 @@ void display_board(struct sudoku_state_t* state) | |||
1015 | rb->lcd_hline(XOFSSCRATCHPAD,XOFSSCRATCHPAD+CELL_WIDTH+1, | 1015 | rb->lcd_hline(XOFSSCRATCHPAD,XOFSSCRATCHPAD+CELL_WIDTH+1, |
1016 | YOFS+cellypos[8]+CELL_HEIGHT+1); | 1016 | YOFS+cellypos[8]+CELL_HEIGHT+1); |
1017 | #endif | 1017 | #endif |
1018 | if (state->possiblevals[state->y][state->x]&(1<<(r))) | 1018 | if (state->possiblevals[state->y][state->x]&BIT_N(r)) |
1019 | rb->lcd_bitmap_part(sudoku_normal,NUMBER_TYPE,BITMAP_HEIGHT*r, | 1019 | rb->lcd_bitmap_part(sudoku_normal,NUMBER_TYPE,BITMAP_HEIGHT*r, |
1020 | BITMAP_STRIDE,XOFSSCRATCHPAD+1,YOFS+cellypos[8], | 1020 | BITMAP_STRIDE,XOFSSCRATCHPAD+1,YOFS+cellypos[8], |
1021 | CELL_WIDTH,CELL_HEIGHT); | 1021 | CELL_WIDTH,CELL_HEIGHT); |
@@ -1552,7 +1552,7 @@ enum plugin_status plugin_start(const void* parameter) | |||
1552 | /* Toggle current number in the possiblevals structure */ | 1552 | /* Toggle current number in the possiblevals structure */ |
1553 | if (state.currentboard[state.y][state.x]!='0') { | 1553 | if (state.currentboard[state.y][state.x]!='0') { |
1554 | state.possiblevals[state.y][state.x]^= | 1554 | state.possiblevals[state.y][state.x]^= |
1555 | (1 << (state.currentboard[state.y][state.x] - '0')); | 1555 | BIT_N(state.currentboard[state.y][state.x] - '0'); |
1556 | } | 1556 | } |
1557 | break; | 1557 | break; |
1558 | #endif | 1558 | #endif |