|
|
@ -100,7 +100,7 @@ int db_usage_map(imdb_t *db, unsigned short int cols) |
|
|
|
int rec_bitmap(imdb_t *db, uint64_t number) |
|
|
|
int rec_bitmap(imdb_t *db, uint64_t number) |
|
|
|
{ |
|
|
|
{ |
|
|
|
imdb_rec_t rec; |
|
|
|
imdb_rec_t rec; |
|
|
|
unsigned char *map, *p, c; |
|
|
|
unsigned char *map = NULL; |
|
|
|
|
|
|
|
|
|
|
|
assert(db != NULL); |
|
|
|
assert(db != NULL); |
|
|
|
memset(&rec, 0x0, sizeof(imdb_rec_t)); |
|
|
|
memset(&rec, 0x0, sizeof(imdb_rec_t)); |
|
|
@ -109,21 +109,13 @@ int rec_bitmap(imdb_t *db, uint64_t number) |
|
|
|
if (imdb_read_rec(db, &rec) < 1) |
|
|
|
if (imdb_read_rec(db, &rec) < 1) |
|
|
|
return -1; |
|
|
|
return -1; |
|
|
|
|
|
|
|
|
|
|
|
if (!rec.data[0]) { |
|
|
|
if (rec.data[0] != 0xFF) { |
|
|
|
puts("Sample not exists"); |
|
|
|
puts("Sample not exists"); |
|
|
|
return 0; |
|
|
|
return 0; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
bitmap_unpack(&rec.data[REC_OFF_BM], &map); |
|
|
|
bitmap_unpack(&rec.data[REC_OFF_BM], &map); |
|
|
|
|
|
|
|
bitmap_print(map); |
|
|
|
p = map; |
|
|
|
|
|
|
|
for (size_t i = 0; i < BITMAP_SIDE; i++) { |
|
|
|
|
|
|
|
for (size_t j = 0; j < BITMAP_SIDE; j++, p++) { |
|
|
|
|
|
|
|
c = (*p == 0x00) ? CHAR_NONE : CHAR_USED; |
|
|
|
|
|
|
|
putchar(c); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
putchar('\n'); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return 0; |
|
|
|
return 0; |
|
|
|
} |
|
|
|
} |
|
|
@ -134,8 +126,6 @@ int rec_diff(imdb_t *db, uint64_t a, uint64_t b, unsigned short int showmap) |
|
|
|
imdb_rec_t dst; |
|
|
|
imdb_rec_t dst; |
|
|
|
float diff = 0.0; |
|
|
|
float diff = 0.0; |
|
|
|
unsigned char map[BITMAP_SIZE]; |
|
|
|
unsigned char map[BITMAP_SIZE]; |
|
|
|
uint16_t row; |
|
|
|
|
|
|
|
uint8_t i, j; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
assert(db != NULL); |
|
|
|
assert(db != NULL); |
|
|
|
|
|
|
|
|
|
|
@ -168,17 +158,8 @@ int rec_diff(imdb_t *db, uint64_t a, uint64_t b, unsigned short int showmap) |
|
|
|
return 0; |
|
|
|
return 0; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
bitmap_diffmap(&map[0], src.data + REC_OFF_BM, dst.data + REC_OFF_BM); |
|
|
|
bitmap_diffmap(&map[0], &src.data[REC_OFF_BM], &dst.data[REC_OFF_BM]); |
|
|
|
|
|
|
|
bitmap_print(map); |
|
|
|
for (i = 0; i < 16; i++) { |
|
|
|
|
|
|
|
row = *(((uint16_t *) map) + i); |
|
|
|
|
|
|
|
for (j = 0; j < 16; j++) { |
|
|
|
|
|
|
|
putchar((row & 1) == 1 ? CHAR_USED : CHAR_NONE); |
|
|
|
|
|
|
|
putchar((row & 1) == 1 ? CHAR_USED : CHAR_NONE); |
|
|
|
|
|
|
|
row >>= 1; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
putchar('\n'); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return 0; |
|
|
|
return 0; |
|
|
|
} |
|
|
|
} |
|
|
|