diff options
Diffstat (limited to 'ewah/bitmap.c')
-rw-r--r-- | ewah/bitmap.c | 18 |
1 files changed, 11 insertions, 7 deletions
diff --git a/ewah/bitmap.c b/ewah/bitmap.c index 38a47c4..ac7e0af 100644 --- a/ewah/bitmap.c +++ b/ewah/bitmap.c @@ -16,7 +16,7 @@ * You should have received a copy of the GNU General Public License * along with this program; if not, see <http://www.gnu.org/licenses/>. */ -#include "cache.h" +#include "git-compat-util.h" #include "ewok.h" #define EWAH_MASK(x) ((eword_t)1 << (x % BITS_IN_EWORD)) @@ -169,6 +169,15 @@ size_t bitmap_popcount(struct bitmap *self) return count; } +int bitmap_is_empty(struct bitmap *self) +{ + size_t i; + for (i = 0; i < self->word_alloc; i++) + if (self->words[i]) + return 0; + return 1; +} + int bitmap_equals(struct bitmap *self, struct bitmap *other) { struct bitmap *big, *small; @@ -216,14 +225,9 @@ int bitmap_is_subset(struct bitmap *self, struct bitmap *other) return 0; } -void bitmap_reset(struct bitmap *bitmap) -{ - memset(bitmap->words, 0x0, bitmap->word_alloc * sizeof(eword_t)); -} - void bitmap_free(struct bitmap *bitmap) { - if (bitmap == NULL) + if (!bitmap) return; free(bitmap->words); |