From: Al Viro <viro@ZenIV.linux.org.uk>
To: Oliver Neukum <oneukum@suse.de>
Cc: linux-kernel <linux-kernel@vger.kernel.org>
Subject: Re: question oh macros and gcc's intelligence
Date: Thu, 17 Mar 2011 09:06:41 +0000 [thread overview]
Message-ID: <20110317090641.GA22723@ZenIV.linux.org.uk> (raw)
In-Reply-To: <201103170848.57688.oneukum@suse.de>
On Thu, Mar 17, 2011 at 08:48:57AM +0100, Oliver Neukum wrote:
> Hi,
>
> if I write:
>
> if (le16_to_cpu(p) == CONST) a();
>
> is gcc smart enough to convert CONST to le16 and do
> a simple comparison?
On little-endian - certainly, on big-endian - forget it.
if (p == cpu_to_le16(CONST))
would obviously work on any architecture and yes, it would be a comparison
with compile-time constant.
prev parent reply other threads:[~2011-03-17 9:06 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-03-17 7:48 question oh macros and gcc's intelligence Oliver Neukum
2011-03-17 9:06 ` Al Viro [this message]
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=20110317090641.GA22723@ZenIV.linux.org.uk \
--to=viro@zeniv.linux.org.uk \
--cc=linux-kernel@vger.kernel.org \
--cc=oneukum@suse.de \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.