25 #define BM_col_to_byte(x) ((x) >> 3)
26 #define BM_col_to_bit(x) ((x) & 7)
64 for (i = 0; i < map->
rows; i++) {
93 for (i = 0; i < map->
rows; i++) {
127 struct BMlink *p, *p2, *prev;
155 if (dist_a == 0 &&
x > 0) {
183 if (dist_a == 0 &&
x > 0) {
271 size = (size_t)map->
rows *
sizeof(
struct BMlink *);
272 for (i = 0; i < map->
rows; i++) {
275 size +=
sizeof(
struct BMlink);
299 for (i = 0; i < map->
rows; i++) {
302 fprintf(stdout,
"(%2d %2d) ", p->
count, p->
val);
305 fprintf(stdout,
"\n");
332 fprintf(stdout,
"(%2d %2d) ", p->
count, p->
val);
335 fprintf(stdout,
"\n");
361 fwrite(&c,
sizeof(
char),
sizeof(
char), fp);
366 fwrite(&c,
sizeof(
char),
sizeof(
char), fp);
368 fwrite(&(map->
rows),
sizeof(map->
rows),
sizeof(
char), fp);
370 fwrite(&(map->
cols),
sizeof(map->
cols),
sizeof(
char), fp);
372 for (y = 0; y < map->
rows; y++) {
383 fwrite(&i,
sizeof(i),
sizeof(
char), fp);
389 fwrite(&i,
sizeof(i),
sizeof(
char), fp);
392 fwrite(&i,
sizeof(i),
sizeof(
char), fp);
struct link_head * link_init(int)
void link_dispose(struct link_head *, VOID_T *)
void link_set_chunk_size(int)
void link_cleanup(struct link_head *)
VOID_T * link_new(struct link_head *)
struct BM * BM_create_sparse(int x, int y)
Create a sparse bitmap of dimension 'x'/'y'.
int BM_dump_map_row_sparse(struct BM *map, int y)
Debugging code to dump out structure of links for single row.
int BM_file_write_sparse(FILE *fp, struct BM *map)
Write sparse bitmap matrix out to disk file 'fp'. NOTE: 'fp' must already be opened and later closed ...
int BM_get_sparse(struct BM *map, int x, int y)
Returns sparse bitmap value at location 'x'/'y'.
size_t BM_get_map_size_sparse(struct BM *map)
Returns size of sparse bitmap in bytes.
int BM_destroy_sparse(struct BM *map)
Destroy sparse bitmap and free all associated memory.
int BM_set_sparse(struct BM *map, int x, int y, int val)
Set sparse bitmap value to 'val' at location 'x'/'y'.
int BM_dump_map_sparse(struct BM *map)
Debugging code to dump out structure of links.