git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: John Tapsell <johnflux@gmail.com>
To: Johannes Schindelin <Johannes.Schindelin@gmx.de>
Cc: Christian Couder <chriscool@tuxfamily.org>,
	Junio C Hamano <gitster@pobox.com>,
	git@vger.kernel.org, Ingo Molnar <mingo@elte.hu>
Subject: Re: [PATCH] rev-list: estimate number of bisection step left
Date: Tue, 17 Feb 2009 15:36:03 +0000	[thread overview]
Message-ID: <43d8ce650902170736h6316f987qc783edeebf488b40@mail.gmail.com> (raw)
In-Reply-To: <alpine.DEB.1.00.0902171630130.6185@intel-tinevez-2-302>

2009/2/17 Johannes Schindelin <Johannes.Schindelin@gmx.de>:
> Hi,
>
> On Tue, 17 Feb 2009, John Tapsell wrote:
>
>> 2009/2/17 Johannes Schindelin <Johannes.Schindelin@gmx.de>:
>>
>> > On Tue, 17 Feb 2009, Christian Couder wrote:
>> >
>> >> +static int estimate_bisect_steps(int all)
>> >> +{
>> >> +     int log2 = 0;
>> >> +     int left = (all >> 1) - 1;
>> >> +
>> >> +     if (left <= 0)
>> >> +             return 0;
>> >> +
>> >> +     do {
>> >> +             left = left >> 1;
>> >> +             log2++;
>> >> +     } while (left);
>> >> +
>> >> +     return log2;
>> >> +}
>> >
>> > How about this instead, calling it from cmd_rev_list directly?
>> >
>> >        static int log2(int n)
>> >        {
>> >                int log2;
>> >
>> >                for (log2 = 0; n > 1; log2++)
>> >                        n >>= 1;
>> >
>> >                return log2;
>> >        }
>>
>> This would work, if you want a non-iterative solution
>>
>> unsigned int log2_integer_approximate(unsigned int n){
>> *((float*)&n) = (float)n;
>> return ((n & (~((1<<23) - 1))) >> 23) - 127;
>> }
>
> That assumes that your floats are IEEE floats, right?

Yeah.  Is it a bad assumption? Does git run on any system in which they aren't?

>
> Ciao,
> Dscho
>

  reply	other threads:[~2009-02-17 15:37 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-02-17  5:09 [PATCH] rev-list: estimate number of bisection step left Christian Couder
2009-02-17  7:28 ` Junio C Hamano
2009-02-19  5:16   ` Christian Couder
2009-02-19  5:26     ` Christian Couder
2009-02-19  5:32     ` Christian Couder
2009-02-19  6:02       ` John Tapsell
2009-02-19  6:49         ` Christian Couder
2009-02-17 14:44 ` Johannes Schindelin
2009-02-17 15:11   ` John Tapsell
2009-02-17 15:31     ` Johannes Schindelin
2009-02-17 15:36       ` John Tapsell [this message]
2009-02-17 15:39         ` Johannes Schindelin
2009-02-17 15:39       ` Thomas Rast

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=43d8ce650902170736h6316f987qc783edeebf488b40@mail.gmail.com \
    --to=johnflux@gmail.com \
    --cc=Johannes.Schindelin@gmx.de \
    --cc=chriscool@tuxfamily.org \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.com \
    --cc=mingo@elte.hu \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).