]> git.ipfire.org Git - thirdparty/git.git/commit
ewah: implement `bitmap_is_empty()`
authorTaylor Blau <me@ttaylorr.com>
Thu, 14 Dec 2023 22:23:59 +0000 (17:23 -0500)
committerJunio C Hamano <gitster@pobox.com>
Thu, 14 Dec 2023 22:38:07 +0000 (14:38 -0800)
commite5d48bf38bc0e1f44f4daa7c8e0f75cd9296d020
tree24cc1a25935239a3e8bec52f97f31c869f3faf11
parentdab60934e3057642453bcc6153af076cbcac0d47
ewah: implement `bitmap_is_empty()`

In a future commit, we will want to check whether or not a bitmap has
any bits set in any of its words. The best way to do this (prior to the
existence of this patch) is to call `bitmap_popcount()` and check
whether the result is non-zero.

But this is semi-wasteful, since we do not need to know the exact number
of bits set, only whether or not there is at least one of them.

Implement a new helper function to check just that.

Suggested-by: Patrick Steinhardt <ps@pks.im>
Signed-off-by: Taylor Blau <me@ttaylorr.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
ewah/bitmap.c
ewah/ewok.h