lkml.org 
[lkml]   [2011]   [Mar]   [17]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: 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.


\
 
 \ /
  Last update: 2011-03-17 10:09    [W:0.042 / U:1.820 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site