From: Elijah Newren <newren@gmail.com>
To: Stefan Beller <sbeller@google.com>
Cc: git <git@vger.kernel.org>
Subject: Re: [PATCH 2/4] Remove silent clamp of renameLimit
Date: Fri, 10 Nov 2017 10:36:17 -0800 [thread overview]
Message-ID: <CABPp-BGwoduH_T7U4uN5A-h43wREfXdQgV8YCVWf8w5N09cYSw@mail.gmail.com> (raw)
In-Reply-To: <CAGZ79kbqxA9U7EsU6_i895vgrTUwmqv8f02NCoUqPS1_nD2PtA@mail.gmail.com>
Thanks for taking a look!
On Fri, Nov 10, 2017 at 10:26 AM, Stefan Beller <sbeller@google.com> wrote:
<snip>
>> - if (rename_limit <= 0 || rename_limit > 32767)
>> - rename_limit = 32767;
>> if ((num_create <= rename_limit || num_src <= rename_limit) &&
>> - (num_create * num_src <= rename_limit * rename_limit))
>> + ((double)num_create * (double)num_src
>> + <= (double)rename_limit * (double)rename_limit))
>> return 0;
>
> From a technical perspective, I would think that if
> (num_create <= rename_limit || num_src <= rename_limit)
> holds true, that the double-cast condition would also be always true?
> Could we just remove that last check?
Not necessarily. For example, if num_create = rename_limit-1 and
num_src = rename_limit+2, then the first condition will be satisfied
but the second won't. If it was && rather than ||, then the second
condition would be superfluous.
> Or phrased differently, if we can cast to double and extend the check
> here, do we have to adapt code at other places as well?
Good point, and yes. Perhaps I should have re-ordered my patch series
because I came back to it later and realized that the progress code
was broken due to overflow/wraparound, and a patch 3 fixed that.
Further, the later patch used uint64_t instead of double. While
double works, perhaps I should change the double here to uint64_t for
consistency?
next prev parent reply other threads:[~2017-11-10 18:36 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-11-10 17:39 [PATCH 0/4] Fix issues with rename detection limits Elijah Newren
2017-11-10 17:39 ` [PATCH 1/4] sequencer: Warn when internal merge may be suboptimal due to renameLimit Elijah Newren
2017-11-13 5:16 ` Junio C Hamano
2017-11-10 17:39 ` [PATCH 2/4] Remove silent clamp of renameLimit Elijah Newren
2017-11-10 18:26 ` Stefan Beller
2017-11-10 18:36 ` Elijah Newren [this message]
2017-11-10 23:42 ` brian m. carlson
2017-11-11 16:39 ` Elijah Newren
2017-11-11 17:32 ` brian m. carlson
2017-11-10 17:39 ` [PATCH 3/4] progress: Fix progress meters when dealing with lots of work Elijah Newren
2017-11-13 5:24 ` Junio C Hamano
2017-11-13 20:05 ` Elijah Newren
2017-11-14 1:18 ` Junio C Hamano
2017-11-10 17:39 ` [PATCH 4/4] sequencer: Show rename progress during cherry picks Elijah Newren
2017-11-13 5:25 ` Junio C Hamano
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=CABPp-BGwoduH_T7U4uN5A-h43wREfXdQgV8YCVWf8w5N09cYSw@mail.gmail.com \
--to=newren@gmail.com \
--cc=git@vger.kernel.org \
--cc=sbeller@google.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.
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).