Browse Source

+ bitmap_diffmap()

master
Alex 'AdUser' Z 11 years ago
parent
commit
2688698c39
  1. 14
      src/bitmap.c
  2. 6
      src/bitmap.h

14
src/bitmap.c

@ -53,3 +53,17 @@ bitmap_compare(const unsigned char *a,
return cnt;
}
int
bitmap_diffmap(const unsigned char *diff,
const unsigned char *a,
const unsigned char *b)
{
size_t i = 0;
for (i = 0; i < BITMAP_SIZE; i++, a++, b++, diff++) {
*diff = *a ^ *b;
}
return i;
}

6
src/bitmap.h

@ -1,4 +1,5 @@
#ifndef HAS_BITMAP_H
#define HAS_BITMAP_H 1
#define BITMAP_SIZE 32
#define BITMAP_BITS 256
@ -9,5 +10,8 @@ int
bitmap_compare(const unsigned char *a,
const unsigned char *b);
int
bitmap_diffmap(const unsigned char *diff,
const unsigned char *a,
const unsigned char *b)
#endif
#define HAS_BITMAP_H 1

Loading…
Cancel
Save