Re: [PATCH] lib: One less subtraction in binary search iterations.

2013-07-09 Thread Mikael Pettersson
Vineet Gupta writes: > On 07/09/2013 09:21 AM, Wedson Almeida Filho wrote: > > On Sat, Jul 6, 2013 at 9:59 PM, Joe Perches wrote: > >> > >> Not correct. > >> > >>> while (start < end) { > >>> - size_t mid = start + (end - start) / 2; > >>> + size_t mid =

Re: [PATCH] lib: One less subtraction in binary search iterations.

2013-07-09 Thread Vineet Gupta
On 07/09/2013 09:21 AM, Wedson Almeida Filho wrote: > On Sat, Jul 6, 2013 at 9:59 PM, Joe Perches wrote: >> >> Not correct. >> >>> while (start < end) { >>> - size_t mid = start + (end - start) / 2; >>> + size_t mid = (start + end) / 2; >> >> size_t start =

Re: [PATCH] lib: One less subtraction in binary search iterations.

2013-07-09 Thread Vineet Gupta
On 07/09/2013 09:21 AM, Wedson Almeida Filho wrote: On Sat, Jul 6, 2013 at 9:59 PM, Joe Perches j...@perches.com wrote: Not correct. while (start end) { - size_t mid = start + (end - start) / 2; + size_t mid = (start + end) / 2; size_t start =

Re: [PATCH] lib: One less subtraction in binary search iterations.

2013-07-09 Thread Mikael Pettersson
Vineet Gupta writes: On 07/09/2013 09:21 AM, Wedson Almeida Filho wrote: On Sat, Jul 6, 2013 at 9:59 PM, Joe Perches j...@perches.com wrote: Not correct. while (start end) { - size_t mid = start + (end - start) / 2; + size_t mid = (start + end)

Re: [PATCH] lib: One less subtraction in binary search iterations.

2013-07-08 Thread Wedson Almeida Filho
On Mon, Jul 8, 2013 at 9:12 PM, Joe Perches 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). > > That's flatly incorrect. I'm not arguing this. I in fact already acknowledged that the statement is

Re: [PATCH] lib: One less subtraction in binary search iterations.

2013-07-08 Thread Joe Perches
On Mon, 2013-07-08 at 20:51 -0700, Wedson Almeida Filho wrote: > On Sat, Jul 6, 2013 at 9:59 PM, Joe Perches wrote: > > > > Not correct. > > > >> while (start < end) { > >> - size_t mid = start + (end - start) / 2; > >> + size_t mid = (start + end) / 2; > > > >

Re: [PATCH] lib: One less subtraction in binary search iterations.

2013-07-08 Thread Wedson Almeida Filho
On Sat, Jul 6, 2013 at 9:59 PM, Joe Perches wrote: > > Not correct. > >> while (start < end) { >> - size_t mid = start + (end - start) / 2; >> + size_t mid = (start + end) / 2; > > size_t start = 0x8000; > size_t end = 0x8001; Good point,

Re: [PATCH] lib: One less subtraction in binary search iterations.

2013-07-08 Thread Wedson Almeida Filho
On Sat, Jul 6, 2013 at 9:59 PM, Joe Perches j...@perches.com wrote: Not correct. while (start end) { - size_t mid = start + (end - start) / 2; + size_t mid = (start + end) / 2; size_t start = 0x8000; size_t end = 0x8001; Good

Re: [PATCH] lib: One less subtraction in binary search iterations.

2013-07-08 Thread Joe Perches
On Mon, 2013-07-08 at 20:51 -0700, Wedson Almeida Filho wrote: On Sat, Jul 6, 2013 at 9:59 PM, Joe Perches j...@perches.com wrote: Not correct. while (start end) { - size_t mid = start + (end - start) / 2; + size_t mid = (start + end) / 2;

Re: [PATCH] lib: One less subtraction in binary search iterations.

2013-07-08 Thread Wedson Almeida Filho
On Mon, Jul 8, 2013 at 9:12 PM, Joe Perches j...@perches.com 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). That's flatly incorrect. I'm not arguing this. I in fact already acknowledged that the

Re: [PATCH] lib: One less subtraction in binary search iterations.

2013-07-07 Thread Rusty Russell
Wedson Almeida Filho writes: > There is no functional change, but this change eliminates a subtraction that > the compiler doesn't optimize out (as of gcc 4.7.3). > > Signed-off-by: Wedson Almeida Filho > --- > lib/bsearch.c |2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff

Re: [PATCH] lib: One less subtraction in binary search iterations.

2013-07-07 Thread Rusty Russell
Wedson Almeida Filho wedso...@gmail.com writes: There is no functional change, but this change eliminates a subtraction that the compiler doesn't optimize out (as of gcc 4.7.3). Signed-off-by: Wedson Almeida Filho wedso...@gmail.com --- lib/bsearch.c |2 +- 1 file changed, 1

Re: [PATCH] lib: One less subtraction in binary search iterations.

2013-07-06 Thread Joe Perches
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

Re: [PATCH] lib: One less subtraction in binary search iterations.

2013-07-06 Thread Joe Perches
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