svn commit: r187251 - head/sys/mips/malta
christoph.mallon at gmx.de
Thu Jan 15 03:58:20 PST 2009
Alexey Dokuchaev schrieb:
> On Wed, Jan 14, 2009 at 07:05:27PM -0700, M. Warner Losh wrote:
>> In message: <20090115020752.52566769.stas at FreeBSD.org>
>> Stanislav Sedov <stas at 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.
More information about the svn-src-head