lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:	Sat, 06 Jul 2013 21:59:29 -0700
From:	Joe Perches <joe@...ches.com>
To:	Wedson Almeida Filho <wedsonaf@...il.com>
Cc:	Rusty Russell <rusty@...tcorp.com.au>,
	Tim Abbott <tabbott@...lice.com>, linux-kernel@...r.kernel.org
Subject: Re: [PATCH] lib: One less subtraction in binary search iterations.

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;


--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ