[PATCH] bitmap:improve memory usage using CHAR_BITS and unsigned CHAR
authorRobert Mast <beheerder@tekenbeetziekten.nl>
Sun, 10 Feb 2013 17:24:16 +0000 (18:24 +0100)
committerW. Trevor King <wking@tremily.us>
Fri, 7 Nov 2014 17:53:33 +0000 (09:53 -0800)
a9/a7683608b2b79b1cc3e184536d86483ebbef82 [new file with mode: 0644]

diff --git a/a9/a7683608b2b79b1cc3e184536d86483ebbef82 b/a9/a7683608b2b79b1cc3e184536d86483ebbef82
new file mode 100644 (file)
index 0000000..225f42f
--- /dev/null
@@ -0,0 +1,90 @@
+Return-Path: <beheerder@tekenbeetziekten.nl>\r
+X-Original-To: notmuch@notmuchmail.org\r
+Delivered-To: notmuch@notmuchmail.org\r
+Received: from localhost (localhost [127.0.0.1])\r
+       by olra.theworths.org (Postfix) with ESMTP id C0359431FBF\r
+       for <notmuch@notmuchmail.org>; Mon, 11 Feb 2013 10:24:35 -0800 (PST)\r
+X-Virus-Scanned: Debian amavisd-new at olra.theworths.org\r
+X-Spam-Flag: NO\r
+X-Spam-Score: 0\r
+X-Spam-Level: \r
+X-Spam-Status: No, score=0 tagged_above=-999 required=5 tests=[none]\r
+       autolearn=disabled\r
+Received: from olra.theworths.org ([127.0.0.1])\r
+       by localhost (olra.theworths.org [127.0.0.1]) (amavisd-new, port 10024)\r
+       with ESMTP id bU6ZgLe7Gnhw for <notmuch@notmuchmail.org>;\r
+       Mon, 11 Feb 2013 10:24:34 -0800 (PST)\r
+Received: from srv047132.webreus.nl (srv047132.webreus.nl [46.235.47.132])\r
+       (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits))\r
+       (No client certificate requested)\r
+       by olra.theworths.org (Postfix) with ESMTPS id C2A6D431FBC\r
+       for <notmuch@notmuchmail.org>; Mon, 11 Feb 2013 10:24:28 -0800 (PST)\r
+Received: (qmail 21948 invoked from network); 10 Feb 2013 18:24:27 +0100\r
+Received: from ip73-109-210-87.adsl2.static.versatel.nl (HELO linux2.foo)\r
+       (87.210.109.73)\r
+       by srv047132.webreus.nl with SMTP; 10 Feb 2013 18:24:27 +0100\r
+From: Robert Mast <beheerder@tekenbeetziekten.nl>\r
+To: notmuch@notmuchmail.org\r
+Subject: [PATCH] bitmap:improve memory usage using CHAR_BITS and unsigned CHAR\r
+Date: Sun, 10 Feb 2013 18:24:16 +0100\r
+Message-Id: <1360517056-7066-1-git-send-email-beheerder@tekenbeetziekten.nl>\r
+X-Mailer: git-send-email 1.7.9.5\r
+In-Reply-To: <1359917491-17178-1-git-send-email-beheerder@tekenbeetziekten.nl>\r
+References: <1359917491-17178-1-git-send-email-beheerder@tekenbeetziekten.nl>\r
+Cc: Robert Mast <beheerder@tekenbeetziekten.nl>\r
+X-BeenThere: notmuch@notmuchmail.org\r
+X-Mailman-Version: 2.1.13\r
+Precedence: list\r
+List-Id: "Use and development of the notmuch mail system."\r
+       <notmuch.notmuchmail.org>\r
+List-Unsubscribe: <http://notmuchmail.org/mailman/options/notmuch>,\r
+       <mailto:notmuch-request@notmuchmail.org?subject=unsubscribe>\r
+List-Archive: <http://notmuchmail.org/pipermail/notmuch>\r
+List-Post: <mailto:notmuch@notmuchmail.org>\r
+List-Help: <mailto:notmuch-request@notmuchmail.org?subject=help>\r
+List-Subscribe: <http://notmuchmail.org/mailman/listinfo/notmuch>,\r
+       <mailto:notmuch-request@notmuchmail.org?subject=subscribe>\r
+X-List-Received-Date: Mon, 11 Feb 2013 18:24:36 -0000\r
+\r
+A little bug-fix to learn how to contribute to nutmuch, this time a combined commit with git rebase to provide one patch from 15.1.\r
+---\r
+ lib/query.cc |   10 +++++-----\r
+ 1 file changed, 5 insertions(+), 5 deletions(-)\r
+\r
+diff --git a/lib/query.cc b/lib/query.cc\r
+index e9c1a2d..7381a54 100644\r
+--- a/lib/query.cc\r
++++ b/lib/query.cc\r
+@@ -39,12 +39,12 @@ typedef struct _notmuch_mset_messages {\r
+ } notmuch_mset_messages_t;\r
\r
+ struct _notmuch_doc_id_set {\r
+-    unsigned int *bitmap;\r
++    unsigned char *bitmap;\r
+     unsigned int bound;\r
+ };\r
\r
+-#define DOCIDSET_WORD(bit) ((bit) / sizeof (unsigned int))\r
+-#define DOCIDSET_BIT(bit) ((bit) % sizeof (unsigned int))\r
++#define DOCIDSET_WORD(bit) ((bit) / CHAR_BIT)\r
++#define DOCIDSET_BIT(bit) ((bit) % CHAR_BIT)\r
\r
+ struct visible _notmuch_threads {\r
+     notmuch_query_t *query;\r
+@@ -359,11 +359,11 @@ _notmuch_doc_id_set_init (void *ctx,\r
+                         GArray *arr)\r
+ {\r
+     unsigned int max = 0;\r
+-    unsigned int *bitmap;\r
++    unsigned char *bitmap;\r
\r
+     for (unsigned int i = 0; i < arr->len; i++)\r
+       max = MAX(max, g_array_index (arr, unsigned int, i));\r
+-    bitmap = talloc_zero_array (ctx, unsigned int, 1 + max / sizeof (*bitmap));\r
++    bitmap = talloc_zero_array (ctx, unsigned char, DOCIDSET_WORD(max) + 1);\r
\r
+     if (bitmap == NULL)\r
+       return FALSE;\r
+-- \r
+1.7.9.5\r
+\r