[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <20110317090641.GA22723@ZenIV.linux.org.uk>
Date: Thu, 17 Mar 2011 09:06:41 +0000
From: Al Viro <viro@...IV.linux.org.uk>
To: Oliver Neukum <oneukum@...e.de>
Cc: linux-kernel <linux-kernel@...r.kernel.org>
Subject: Re: question oh macros and gcc's intelligence
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.
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists