@@ -200,6 +200,30 @@ int bitmap_equals(struct bitmap *self, struct bitmap *other)
return 1;
}
+int bitmap_diff_nonzero(struct bitmap *self, struct bitmap *other)
+{
+ struct bitmap *small;
+ size_t i;
+
+ if (self->word_alloc < other->word_alloc) {
+ small = self;
+ } else {
+ small = other;
+
+ for (i = other->word_alloc; i < self->word_alloc; i++) {
+ if (self->words[i] != 0)
+ return 1;
+ }
+ }
+
+ for (i = 0; i < small->word_alloc; i++) {
+ if ((self->words[i] & ~other->words[i]))
+ return 1;
+ }
+
+ return 0;
+}
+
void bitmap_reset(struct bitmap *bitmap)
{
memset(bitmap->words, 0x0, bitmap->word_alloc * sizeof(eword_t));
@@ -180,7 +180,7 @@ int bitmap_get(struct bitmap *self, size_t pos);
void bitmap_reset(struct bitmap *self);
void bitmap_free(struct bitmap *self);
int bitmap_equals(struct bitmap *self, struct bitmap *other);
-int bitmap_is_subset(struct bitmap *self, struct bitmap *super);
+int bitmap_diff_nonzero(struct bitmap *self, struct bitmap *other);
struct ewah_bitmap * bitmap_to_ewah(struct bitmap *bitmap);
struct bitmap *ewah_to_bitmap(struct ewah_bitmap *ewah);