This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: Mined out of comp.std.c...
- From: Alan Modra <amodra at bigpond dot net dot au>
- To: Zack Weinberg <zack at codesourcery dot com>
- Cc: gcc at gcc dot gnu dot org, Jan Hubicka <jh at suse dot cz>
- Date: Thu, 25 Apr 2002 17:09:09 +0930
- Subject: Re: Mined out of comp.std.c...
- References: <20020425065117.GJ26266@codesourcery.com>
On Wed, Apr 24, 2002 at 11:51:17PM -0700, Zack Weinberg wrote:
> ... an interesting microoptimization.
>
> The original post on comp.std.c is about whether
>
> static int int_max (int a, int b) {
> int d = (b - a);
> return (b - d) & (d >> (CHAR_BIT*sizeof(int) - 1));
> }
This might work better :)
static int int_max (int a, int b) {
int d = (b - a);
return b - (d & (d >> (CHAR_BIT*sizeof(int) - 1)));
}
--
Alan Modra
IBM OzLabs - Linux Technology Centre