aboutsummaryrefslogtreecommitdiff
path: root/src/depmap.c
diff options
context:
space:
mode:
authorSergey Poznyakoff <gray@gnu.org.ua>2009-11-09 02:33:47 +0200
committerSergey Poznyakoff <gray@gnu.org.ua>2009-11-09 02:33:47 +0200
commit07b7c58b5faeb5973b003af94c67540202964bb5 (patch)
treefcc094b9e9cd9a14bfdf132e0e40322c253a7274 /src/depmap.c
parente3405029a2ae73a7d7e9c93624f8206dbd2f2d1c (diff)
downloadpies-07b7c58b5faeb5973b003af94c67540202964bb5.tar.gz
pies-07b7c58b5faeb5973b003af94c67540202964bb5.tar.bz2
Minor change.
* src/depmap.c (struct pies_depmap.nrows,rowlen): Change type to size_t. (depmap_alloc, depmap_rowptr) (depmap_set, depmap_isset) (depmap_next, depmap_first): Use size_t to index map elements. * src/pies.h: Update prototypes accordingly. * src/progman.c: Update depmap function usage.
Diffstat (limited to 'src/depmap.c')
-rw-r--r--src/depmap.c23
1 files changed, 11 insertions, 12 deletions
diff --git a/src/depmap.c b/src/depmap.c
index 1775e06..0b8cb0f 100644
--- a/src/depmap.c
+++ b/src/depmap.c
@@ -20,7 +20,6 @@
# define CHAR_BIT 8
#endif
#define BITS_PER_WORD (sizeof(unsigned)*CHAR_BIT)
-#define MAXTABLE 32767
#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)))
@@ -82,13 +81,13 @@ TC (unsigned *R, int n)
struct pies_depmap
{
- unsigned nrows;
- unsigned rowlen;
+ size_t nrows;
+ size_t rowlen;
unsigned r[1];
};
pies_depmap_t
-depmap_alloc (unsigned count)
+depmap_alloc (size_t count)
{
size_t size = (count + BITS_PER_WORD - 1) / BITS_PER_WORD;
pies_depmap_t dmap = xzalloc (sizeof (*dmap) - 1
@@ -107,20 +106,20 @@ depmap_copy (pies_depmap_t dpm)
}
static unsigned *
-depmap_rowptr (pies_depmap_t dmap, unsigned row)
+depmap_rowptr (pies_depmap_t dmap, size_t row)
{
return dmap->r + dmap->rowlen * row;
}
void
-depmap_set (pies_depmap_t dmap, unsigned row, unsigned col)
+depmap_set (pies_depmap_t dmap, size_t row, size_t col)
{
unsigned *rptr = depmap_rowptr (dmap, row);
SETBIT (rptr, col);
}
int
-depmap_isset (pies_depmap_t dmap, unsigned row, unsigned col)
+depmap_isset (pies_depmap_t dmap, size_t row, size_t col)
{
unsigned *rptr = depmap_rowptr (dmap, row);
return BITISSET (rptr, col);
@@ -135,10 +134,10 @@ depmap_tc (pies_depmap_t dmap)
struct pies_depmap_pos
{
enum pies_depmap_direction dir;
- unsigned coord[2];
+ size_t coord[2];
};
-unsigned
+size_t
depmap_next (pies_depmap_t dmap, pies_depmap_pos_t pos)
{
for (pos->coord[pos->dir]++; pos->coord[pos->dir] < dmap->nrows;
@@ -147,12 +146,12 @@ depmap_next (pies_depmap_t dmap, pies_depmap_pos_t pos)
break;
return pos->coord[pos->dir] == dmap->nrows ?
- (unsigned) -1 : pos->coord[pos->dir];
+ (size_t) -1 : pos->coord[pos->dir];
}
-unsigned
+size_t
depmap_first (pies_depmap_t dmap, enum pies_depmap_direction dir,
- unsigned coord, pies_depmap_pos_t *ppos)
+ size_t coord, pies_depmap_pos_t *ppos)
{
pies_depmap_pos_t pos = xmalloc (sizeof *pos);
*ppos = pos;

Return to:

Send suggestions and report system problems to the System administrator.