From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail1-relais-roc.national.inria.fr (mail1-relais-roc.national.inria.fr [192.134.164.82]) by walapai.inria.fr (8.13.6/8.13.6) with ESMTP id p4RHLH1O000602 for ; Fri, 27 May 2011 19:21:17 +0200 X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: AoAFAKHc301ii1u+fGdsb2JhbAA/AwESG5dhjlMBAQsJCwcUBSKIcK0ngjeEP4kbAQQFAYYYBIZjjhsmilQ X-IronPort-AV: E=Sophos;i="4.65,281,1304287200"; d="scan'208";a="109720697" Received: from nm4-vm0.bullet.mail.sp2.yahoo.com ([98.139.91.190]) by mail1-smtp-roc.national.inria.fr with SMTP; 27 May 2011 19:21:11 +0200 Received: from [98.139.91.62] by nm4.bullet.mail.sp2.yahoo.com with NNFMP; 27 May 2011 17:21:10 -0000 Received: from [98.139.91.45] by tm2.bullet.mail.sp2.yahoo.com with NNFMP; 27 May 2011 17:21:10 -0000 Received: from [127.0.0.1] by omp1045.mail.sp2.yahoo.com with NNFMP; 27 May 2011 17:21:10 -0000 X-Yahoo-Newman-Property: ymail-3 X-Yahoo-Newman-Id: 336463.48008.bm@omp1045.mail.sp2.yahoo.com Received: (qmail 72160 invoked by uid 60001); 27 May 2011 17:21:10 -0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yahoo.com; s=s1024; t=1306516869; bh=mKWcZLbJPGRDzTkPVNH2B5bYLD2mi17XuX3etHbLMDU=; h=Message-ID:X-YMail-OSG:Received:X-Mailer:Date:From:Subject:To:MIME-Version:Content-Type:Content-Transfer-Encoding; b=NFg5b9jl9DUG23usGcQYZrhReMG2Ax3XHmusBS+Mt075lr5P5s+WnIc5h6qVe8ZVyMYNRvLgvqVMs1FZ0HEQwtIG7Ocuvf76OuBjt22J2bCnoLaFCEUaI/c8kfGjckPdPOA8YUDq9RG8fZidXJvxxDA7EQuxeju3+odna8SPdJA= DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=s1024; d=yahoo.com; h=Message-ID:X-YMail-OSG:Received:X-Mailer:Date:From:Subject:To:MIME-Version:Content-Type:Content-Transfer-Encoding; b=Fh0gjCoXhIWSDY/oZnnkrRcmWTdjDURTHYZ0YPWdxZOq8rlI15PShyGDlVpbLLEuaqwag2TfZRI1Kc0IVuplB2ORSdj95+gIbb4DagjTKgmsfFSyeKyxeslq2mFjO9gWZrGtz0zyZZppZIWuHTvyRgZD2i022ZriguoXyAIo+/U=; Message-ID: <891579.63577.qm@web111515.mail.gq1.yahoo.com> X-YMail-OSG: KRh3FtcVM1kNJSXL5YqUAMkwu22fV51jE89x74dq6PQhxV. VQLUipWgtHr_2hAeiBGMp1Uq96ZIzaUEdpCH7LMSw1aqFl1pSuS.zLYzkK7u 62HbflA07QxHBHUbnOm9TYoRDI7dFsFINron0Vq62MVnqzyaVpDumfva2URS 5ZtJd2kQ0lLlq3KGAQuQ7HL7D9IXu9wH9jiq8Bym4ScPtX3_qgzc2IeAARuZ LJKHk7YBKO31YzfyhGi9o0q.0dloV_B6pxIogT6FySjj8uOc2eqf.Z7pVMZj .iFwg1j8.qr5aguc66YRSUtyZmBY5WdqXVXexbrssYKg8zsGE1D.iOZW7O9K dfx776Os00E6_cdmKivE3WA7zrqv8_gjL8WV8qSC1OS1tTIyc8tMULd3I10X V9t.jSEgNbsbBm57wdvyIiZO9a8ytRB8_Hbu0ZSdeLV1JWwMhakjraMfYgxB DRQalKcCcwnGXwe3Ve68rrrSd4d8_lWI4dsa3wS5r8yTsmzrneWA5_A-- Received: from [213.205.70.212] by web111515.mail.gq1.yahoo.com via HTTP; Fri, 27 May 2011 10:21:09 PDT X-Mailer: YahooMailClassic/14.0.1 YahooMailWebService/0.8.111.304355 Date: Fri, 27 May 2011 10:21:09 -0700 (PDT) From: Dario Teixeira To: caml-list@inria.fr, Sylvain Le Gall MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Transfer-Encoding: 8bit X-MIME-Autoconverted: from quoted-printable to 8bit by walapai.inria.fr id p4RHLH1O000602 Subject: Re: [Caml-list] Re: Binary logarithm of a power of 2 Hi, > The code is not bug proof, you should check it ;-) Yeap, there's one bug which manifests itself on whole-byte boundaries (ex: logbin_array 512l, logbin_array 65536l)... > > You can except at least 18% increase in term of performance > on amd64 and a 1% decrease on i386. In my synthetic benchmark it behaves as well as my initial C-based but "alloc-happy" solution, so congratulations!  (Though it is of course slower than the C-based "noalloc" version). Incidentally, I found a web page with lots of cool bit-twiddling hacks, which includes several solutions to the binary logarithm problem: http://graphics.stanford.edu/~seander/bithacks.html Cheers, Dario