From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from localhost (localhost [127.0.0.1]) by olra.theworths.org (Postfix) with ESMTP id 03913431FD6 for ; Wed, 13 Feb 2013 07:15:42 -0800 (PST) X-Virus-Scanned: Debian amavisd-new at olra.theworths.org X-Spam-Flag: NO X-Spam-Score: 0 X-Spam-Level: X-Spam-Status: No, score=0 tagged_above=-999 required=5 tests=[none] autolearn=disabled Received: from olra.theworths.org ([127.0.0.1]) by localhost (olra.theworths.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id Czk6-AiFDpLX for ; Wed, 13 Feb 2013 07:15:41 -0800 (PST) Received: from srv047132.webreus.nl (srv047132.webreus.nl [46.235.47.132]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by olra.theworths.org (Postfix) with ESMTPS id 0CAFC431FC9 for ; Wed, 13 Feb 2013 07:15:40 -0800 (PST) Received: (qmail 17519 invoked from network); 13 Feb 2013 16:15:39 +0100 Received: from ip73-109-210-87.adsl2.static.versatel.nl (HELO PCvangebruike) (87.210.109.73) by srv047132.webreus.nl with SMTP; 13 Feb 2013 16:15:37 +0100 From: "Robert Mast" To: References: <1359917491-17178-1-git-send-email-beheerder@tekenbeetziekten.nl> <1360768303-4228-1-git-send-email-beheerder@tekenbeetziekten.nl> In-Reply-To: <1360768303-4228-1-git-send-email-beheerder@tekenbeetziekten.nl> Subject: RE: [english 100%] [PATCH] bitmap:improve memory usage using CHAR_BITS and unsigned CHAR Date: Wed, 13 Feb 2013 16:15:32 +0100 Message-ID: <007501ce09fc$f85e20d0$e91a6270$@nl> MIME-Version: 1.0 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Mailer: Microsoft Office Outlook 12.0 Thread-Index: Ac4J/Hr6NuL3/WjCTt+Lnhvxo3iRWAAAGxUw Content-Language: nl X-BeenThere: notmuch@notmuchmail.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: "Use and development of the notmuch mail system." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 13 Feb 2013 15:15:42 -0000 Somehow my comments don't get through... I'll try it another way. -----Oorspronkelijk bericht----- Van: Robert Mast [mailto:beheerder@tekenbeetziekten.nl]=20 Verzonden: woensdag 13 februari 2013 16:12 Aan: notmuch@notmuchmail.org CC: Robert Mast Onderwerp: [english 100%] [PATCH] bitmap:improve memory usage using = CHAR_BITS and unsigned CHAR diff --git a/lib/query.cc b/lib/query.cc index e9c1a2d..7381a54 100644 --- a/lib/query.cc +++ b/lib/query.cc @@ -39,12 +39,12 @@ typedef struct _notmuch_mset_messages { } = notmuch_mset_messages_t; =20 struct _notmuch_doc_id_set { - unsigned int *bitmap; + unsigned char *bitmap; unsigned int bound; }; =20 -#define DOCIDSET_WORD(bit) ((bit) / sizeof (unsigned int)) -#define = DOCIDSET_BIT(bit) ((bit) % sizeof (unsigned int)) +#define DOCIDSET_WORD(bit) ((bit) / CHAR_BIT) #define DOCIDSET_BIT(bit) = +((bit) % CHAR_BIT) =20 struct visible _notmuch_threads { notmuch_query_t *query; @@ -359,11 +359,11 @@ _notmuch_doc_id_set_init (void *ctx, GArray *arr) { unsigned int max =3D 0; - unsigned int *bitmap; + unsigned char *bitmap; =20 for (unsigned int i =3D 0; i < arr->len; i++) max =3D MAX(max, g_array_index (arr, unsigned int, i)); - bitmap =3D talloc_zero_array (ctx, unsigned int, 1 + max / sizeof = (*bitmap)); + bitmap =3D talloc_zero_array (ctx, unsigned char, = DOCIDSET_WORD(max)=20 + + 1); =20 if (bitmap =3D=3D NULL) return FALSE; -- 1.7.9.5 .