lkml.org 
[lkml]   [2004]   [Jun]   [24]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH 2.6.7-mm1] MBR centralization
On Thu, Jun 24, 2004 at 08:38:52AM +0100, Anton Altaparmakov wrote:

> While I am at it, the above macro is even further optimized by moving the
> endianness conversion to the constant so it is applied at compile time
> rather than run time like so:
>
> #define MSDOS_MBR(p) ((*(u16*)(p)) == __constant_cpu_to_le16(0xaa55))

I never understand why people want to do such things.
Cast a character pointer to u16*, possibly do a byteswap, etc.
What one wants is just

p[0] == 0x55 && p[1] == 0xaa
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/

\
 
 \ /
  Last update: 2005-03-22 14:04    [W:0.038 / U:0.176 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site