diff options
Diffstat (limited to 'src/depmap.c')
-rw-r--r-- | src/depmap.c | 28 |
1 files changed, 27 insertions, 1 deletions
diff --git a/src/depmap.c b/src/depmap.c index e4533e8..3259880 100644 --- a/src/depmap.c +++ b/src/depmap.c @@ -23,7 +23,7 @@ #define WORDSIZE(n) (((n) + BITS_PER_WORD - 1) / BITS_PER_WORD) #define SETBIT(x, i) ((x)[(i)/BITS_PER_WORD] |= (1<<((i) % BITS_PER_WORD))) -#define RESETBIT(x, i) ((x)[(i)/BITS_PER_WORD] &= ~(1<<((i) % BITS_PER_WORD))) +#define CLRBIT(x, i) ((x)[(i)/BITS_PER_WORD] &= ~(1<<((i) % BITS_PER_WORD))) #define BITISSET(x, i) (((x)[(i)/BITS_PER_WORD] & (1<<((i) % BITS_PER_WORD))) != 0) void @@ -118,6 +118,13 @@ depmap_set (pies_depmap_t dmap, size_t row, size_t col) SETBIT (rptr, col); } +void +depmap_clear (pies_depmap_t dmap, size_t row, size_t col) +{ + unsigned *rptr = depmap_rowptr (dmap, row); + CLRBIT (rptr, col); +} + int depmap_isset (pies_depmap_t dmap, size_t row, size_t col) { @@ -166,3 +173,22 @@ depmap_end (pies_depmap_pos_t pos) { grecs_free (pos); } + +void +depmap_clear_all (pies_depmap_t dmap, enum pies_depmap_direction dir, + size_t coord) +{ + size_t i; + + switch (dir) + { + case depmap_row: + for (i = 0; i < dmap->nrows; i++) + depmap_clear (dmap, coord, i); + break; + + case depmap_col: + for (i = 0; i < dmap->nrows; i++) + depmap_clear (dmap, i, coord); + } +} |