Re: [PATCH 2.6.7-mm1] MBR centralization

From: Andries Brouwer
Date: Thu Jun 24 2004 - 08:15:45 EST


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@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/