From: Joe Perches <joe@perches.com>
To: Wedson Almeida Filho <wedsonaf@gmail.com>
Cc: Rusty Russell <rusty@rustcorp.com.au>,
Tim Abbott <tabbott@ksplice.com>,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH] lib: One less subtraction in binary search iterations.
Date: Sat, 06 Jul 2013 21:59:29 -0700 [thread overview]
Message-ID: <1373173169.1943.1.camel@joe-AO722> (raw)
In-Reply-To: <1373152062-28164-1-git-send-email-wedsonaf@gmail.com>
On Sat, 2013-07-06 at 16:07 -0700, Wedson Almeida Filho wrote:
> There is no functional change, but this change eliminates a subtraction that
> the compiler doesn't optimize out (as of gcc 4.7.3).
Not correct.
> diff --git a/lib/bsearch.c b/lib/bsearch.c
[]
> @@ -37,7 +37,7 @@ void *bsearch(const void *key, const void *base, size_t num, size_t size,
> int result;
>
> while (start < end) {
> - size_t mid = start + (end - start) / 2;
> + size_t mid = (start + end) / 2;
size_t start = 0x80000000;
size_t end = 0x80000001;
next prev parent reply other threads:[~2013-07-07 4:59 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-07-06 23:07 Wedson Almeida Filho
2013-07-07 4:59 ` Joe Perches [this message]
2013-07-09 3:51 ` Wedson Almeida Filho
2013-07-09 4:12 ` Joe Perches
2013-07-09 4:58 ` Wedson Almeida Filho
2013-07-09 6:37 ` [PATCH v2] " Wedson Almeida Filho
2013-07-15 5:07 ` Rusty Russell
2013-07-09 7:47 ` [PATCH] " Vineet Gupta
2013-07-09 9:19 ` Mikael Pettersson
2013-07-08 1:46 ` Rusty Russell
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=1373173169.1943.1.camel@joe-AO722 \
--to=joe@perches.com \
--cc=linux-kernel@vger.kernel.org \
--cc=rusty@rustcorp.com.au \
--cc=tabbott@ksplice.com \
--cc=wedsonaf@gmail.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
all inboxes | Powered by JetHome®