From: Jonathan Nieder <jrnieder@gmail.com>
To: Ralf Thielow <ralf.thielow@googlemail.com>
Cc: git@vger.kernel.org
Subject: Re: [PATCH 1/2] log-tree: simplify digit_in_number
Date: Sun, 25 Jul 2010 12:46:02 -0500 [thread overview]
Message-ID: <20100725174602.GA9146@burratino> (raw)
In-Reply-To: <1280079381-4548-1-git-send-email-ralf.thielow@googlemail.com>
Ralf Thielow wrote:
> +++ b/log-tree.c
> @@ -254,12 +254,10 @@ static void append_signoff(struct strbuf *sb, const char *signoff)
>
> static unsigned int digits_in_number(unsigned int number)
> {
> - unsigned int i = 10, result = 1;
> - while (i <= number) {
> - i *= 10;
> - result++;
> - }
> - return result;
> + int digits = 0;
> + while (number /= 10)
> + digits++;
> + return digits++;
I think you mean "return ++digits;".
But other questions come to mind first:
- What is the motivation? How did this come up and what does your change
improve?
- Why rewrite this in one patch, only to rewrite it again?
Hope that helps,
Jonathan
next prev parent reply other threads:[~2010-07-25 17:47 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-07-25 17:36 [PATCH 1/2] log-tree: simplify digit_in_number Ralf Thielow
2010-07-25 17:36 ` [PATCH 2/2] " Ralf Thielow
2010-07-25 17:46 ` Jonathan Nieder [this message]
-- strict thread matches above, loose matches on Subject: below --
2010-07-25 17:43 [PATCH 1/2] log-tree: " Ralf Thielow
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=20100725174602.GA9146@burratino \
--to=jrnieder@gmail.com \
--cc=git@vger.kernel.org \
--cc=ralf.thielow@googlemail.com \
/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).