From: Chris Jones <clj@emc.com>
To: linux-kernel@vger.kernel.org
Cc: Mike Harrold <mharrold@cas.org>
Subject: Re: * 4 converted to << 2 for networking code
Date: 10 Jan 2001 10:31:34 -0500 [thread overview]
Message-ID: <hplmsjs9t5.fsf@lca2240.lss.emc.com> (raw)
In-Reply-To: <200101101518.KAA11519@mah21awu.cas.org>
In-Reply-To: Mike Harrold's message of "Wed, 10 Jan 2001 10:18:38 -0500 (EST)"
Mike Harrold <mharrold@cas.org> writes:
[...]
My feeling is that it shouldn't matter if you use <<2 or *4 even if the
compiler optimises - one would hope that the compiler would optimise to
the fastest in both directions.
I agree this should be left to the compiler. The programmer should write *4
when multiplying by 4 and <<2 when shifting left by 2. In the case that
sparked this (converting counts of 32 bit units to counts of octets),
multiplication is the proper conversion operation.
(If performance is truly critical AND profiling shows that writing <<2 instead
of *4 makes a significant difference, doing the shift might be called for. I
hardly believe that's the case here, and the fact that the code has to run on
several architectures and be compiled by various compilers makes it less likely
that this change is a clearcut win.)
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
Please read the FAQ at http://www.tux.org/lkml/
next prev parent reply other threads:[~2001-01-10 15:32 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2001-01-10 16:48 * 4 converted to << 2 for networking code antirez
2001-01-10 14:38 ` David S. Miller
2001-01-10 14:54 ` Brian Gerst
2001-01-10 17:03 ` antirez
2001-01-10 15:11 ` Jakob Østergaard
2001-01-10 15:18 ` Mike Harrold
2001-01-10 15:31 ` Chris Jones [this message]
2001-01-10 16:23 ` Jamie Lokier
2001-01-10 16:26 ` Mike Harrold
2001-01-10 17:25 ` antirez
2001-01-10 16:25 ` Pauline Middelink
2001-01-11 0:29 ` H. Peter Anvin
2001-01-10 22:21 ` Matthias Andree
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=hplmsjs9t5.fsf@lca2240.lss.emc.com \
--to=clj@emc.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mharrold@cas.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox