Browse Source

* chg simdb_bitmap_unpack() : use signed char *

master
Alex 'AdUser' Z 8 years ago
parent
commit
47ff55936d
  1. 9
      src/bitmap.c
  2. 3
      src/bitmap.h

9
src/bitmap.c

@ -75,11 +75,10 @@ simdb_bitmap_diffmap(const unsigned char *a,
} }
size_t size_t
simdb_bitmap_unpack(const unsigned char *map, simdb_bitmap_unpack(const unsigned char *map, char **buf) {
unsigned char ** const buf) {
size_t buf_size = SIMDB_BITMAP_BITS; size_t buf_size = SIMDB_BITMAP_BITS;
uint16_t *p, row, mask; uint16_t *p, row, mask;
unsigned char *q = NULL; char *q = NULL;
assert(map != NULL); assert(map != NULL);
assert(buf != NULL); assert(buf != NULL);
@ -92,7 +91,7 @@ simdb_bitmap_unpack(const unsigned char *map,
for (size_t i = 0; i < SIMDB_BITMAP_SIDE; i++, p++) { for (size_t i = 0; i < SIMDB_BITMAP_SIDE; i++, p++) {
row = *p; mask = 0x1; row = *p; mask = 0x1;
for (size_t j = 0; j < SIMDB_BITMAP_SIDE; j++, q++) { for (size_t j = 0; j < SIMDB_BITMAP_SIDE; j++, q++) {
*q = (row & mask) ? 0xFF : 0x00; *q = (row & mask) ? 0x1 : 0x0;
mask <<= 1; mask <<= 1;
} }
} }
@ -102,7 +101,7 @@ simdb_bitmap_unpack(const unsigned char *map,
void void
simdb_bitmap_print(const unsigned char *map) { simdb_bitmap_print(const unsigned char *map) {
unsigned char *buf = NULL, *p = NULL; char *buf = NULL, *p = NULL;
char line[SIMDB_BITMAP_SIDE * 2 + 1]; char line[SIMDB_BITMAP_SIDE * 2 + 1];
simdb_bitmap_unpack(map, &buf); simdb_bitmap_unpack(map, &buf);

3
src/bitmap.h

@ -47,8 +47,7 @@ simdb_bitmap_diffmap(const unsigned char *a,
* @returns Size of generated bytemap (now is @a BITMAP_BITS) * @returns Size of generated bytemap (now is @a BITMAP_BITS)
*/ */
size_t size_t
simdb_bitmap_unpack(const unsigned char *map, simdb_bitmap_unpack(const unsigned char *map, char **buf);
unsigned char ** const buf);
/** /**
* @brief Print bitmap to stdout as ascii-square * @brief Print bitmap to stdout as ascii-square

Loading…
Cancel
Save