git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
From: Johannes Schindelin <Johannes.Schindelin@gmx.de>
To: John Tapsell <johnflux@gmail.com>
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 16:39:54 +0100 (CET)	[thread overview]
Message-ID: <alpine.DEB.1.00.0902171639060.6185@intel-tinevez-2-302> (raw)
In-Reply-To: <43d8ce650902170736h6316f987qc783edeebf488b40@mail.gmail.com>

Hi,

On Tue, 17 Feb 2009, John Tapsell wrote:

> 2009/2/17 Johannes Schindelin <Johannes.Schindelin@gmx.de>:
>
> > 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?

Only when you are porting Git to embedded devices.

Don't moan: there exists a git-daemon for iPhone.  Oh, wait!  /me 
scribbles that down for the UGFWIINI contest.

Ciao,
Dscho

  reply	other threads:[~2009-02-17 15:41 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
2009-02-17 15:39         ` Johannes Schindelin [this message]
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

  List information: http://vger.kernel.org/majordomo-info.html

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

  git send-email \
    --in-reply-to=alpine.DEB.1.00.0902171639060.6185@intel-tinevez-2-302 \
    --to=johannes.schindelin@gmx.de \
    --cc=chriscool@tuxfamily.org \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.com \
    --cc=johnflux@gmail.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.
Code repositories for project(s) associated with this public inbox

	https://80x24.org/mirrors/git.git

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 read-only IMAP folder(s) and NNTP newsgroup(s).