Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 15 Jan 2009 12:58:16 +0100
From:      Christoph Mallon <christoph.mallon@gmx.de>
To:        Alexey Dokuchaev <danfe@FreeBSD.org>
Cc:        src-committers@FreeBSD.org, svn-src-all@FreeBSD.org, stas@FreeBSD.org, gonzo@FreeBSD.org, svn-src-head@FreeBSD.org, "M. Warner Losh" <imp@bsdimp.com>
Subject:   Re: svn commit: r187251 - head/sys/mips/malta
Message-ID:  <496F24D8.2040104@gmx.de>
In-Reply-To: <20090115114407.GA67726@FreeBSD.org>
References:  <200901142232.n0EMWhGw055895@svn.freebsd.org>	<20090115020752.52566769.stas@FreeBSD.org>	<20090114.190527.1058804377.imp@bsdimp.com> <20090115114407.GA67726@FreeBSD.org>

next in thread | previous in thread | raw e-mail | index | archive | help
Alexey Dokuchaev schrieb:
> On Wed, Jan 14, 2009 at 07:05:27PM -0700, M. Warner Losh wrote:
>> In message: <20090115020752.52566769.stas@FreeBSD.org>
>>             Stanislav Sedov <stas@FreeBSD.org> writes:
>> : > +		shift = 8 * (reg & 3);
>> : >  
>> : 
>> : Would it make sense to replace this with
>> : > +		shift = (reg & 3) << 3;
>> : 
>> : to not rely on possible compiler optimizations?
>>
>> I don't think that it matters all that much these days...
> 
> But the name "shift" kinda suggests << instead of *, no?

The value *is* a shift amount (see its uses a few lines down). Its name 
does not imply the way it is calculated, but what it is used for.

BTW: Even the most cheap compilers emit shift instructions for 
multiplication by a power of two. The new code also is clearly faster 
then the old - quite some code gets generated for switches.



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?496F24D8.2040104>