All of lore.kernel.org
 help / color / mirror / Atom feed
From: Aryan Gupta <garyan447@gmail.com>
To: git@vger.kernel.org
Cc: Aryan Gupta <garyan447@gmail.com>
Subject: [GSoC][PATCH 1/1] add zero count optimization in ewah_bitmap.c
Date: Sun, 10 Mar 2024 17:26:14 +0100	[thread overview]
Message-ID: <20240310162614.62691-2-garyan447@gmail.com> (raw)
In-Reply-To: <20240310162614.62691-1-garyan447@gmail.com>

Signed-off-by: Aryan Gupta <garyan447@gmail.com>
---
 ewah/ewah_bitmap.c | 9 +++++----
 1 file changed, 5 insertions(+), 4 deletions(-)

diff --git a/ewah/ewah_bitmap.c b/ewah/ewah_bitmap.c
index 8785cbc54a..9056829572 100644
--- a/ewah/ewah_bitmap.c
+++ b/ewah/ewah_bitmap.c
@@ -257,10 +257,11 @@ void ewah_each_bit(struct ewah_bitmap *self, void (*callback)(size_t, void*), vo
 		for (k = 0; k < rlw_get_literal_words(word); ++k) {
 			int c;
 
-			/* todo: zero count optimization */
-			for (c = 0; c < BITS_IN_EWORD; ++c, ++pos) {
-				if ((self->buffer[pointer] & ((eword_t)1 << c)) != 0)
-					callback(pos, payload);
+			if(self->buffer[pointer]) {
+				for (c = 0; c < BITS_IN_EWORD; ++c, ++pos) {
+					if (((eword_t)1 << c) != 0)
+						callback(pos, payload);
+				}
 			}
 
 			++pointer;
-- 
2.25.1


  reply	other threads:[~2024-03-10 16:26 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-03-10 16:26 [GSoC][PATCH 0/1] add zero count optimization in ewah_bitmap.c Aryan Gupta
2024-03-10 16:26 ` Aryan Gupta [this message]
2024-03-11 16:14   ` [GSoC][PATCH 1/1] " Junio C Hamano
2024-03-11 16:08 ` [GSoC][PATCH 0/1] " Junio C Hamano
2024-03-11 22:29   ` Aryan Gupta
2024-03-13 22:37 ` [GSoC][PATCH v2] Optimize ewah_bitmap.c for efficiency using trailing zeros for set bit iteration Aryan Gupta
2024-03-18  3:08   ` Karthik Nayak
2024-03-18 15:42     ` Junio C Hamano

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20240310162614.62691-2-garyan447@gmail.com \
    --to=garyan447@gmail.com \
    --cc=git@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.