[U-Boot] [PATCH-OMAP3] OMAP3: Remove BITx magic

Wolfgang Denk wd at denx.de
Sun Nov 9 21:24:23 CET 2008


Dear dirk.behme at googlemail.com,

In message <49172e4a.0b38560a.42bc.ffffb794 at mx.google.com> you wrote:
> Subject: [PATCH-OMAP3] OMAP3: Remove BITx magic
> 
> From: Dirk Behme <dirk.behme at gmail.com>
> 
> Remove bits.h and it's macros usage. Requested by Wolfgang Denk.
> 
> Signed-off-by: Dirk Behme <dirk.behme at gmail.com>
...
>  /* device type */
> -#define DEVICE_MASK		(BIT8 | BIT9 | BIT10)
> +#define DEVICE_MASK		(0x7 << 8)

That's a funny way to make code difficult to read. Why do you prefer
"(0x7 << 8)" instead of "0x700" (which looks more obvious to me) ?

> -#define DLL_NO_FILTER_MASK	(BIT8 | BIT9)
> +#define DLL_NO_FILTER_MASK	((0x1 << 9) | (0x1 << 8))

Ditto here - why not simply 0x300 ?

> -#define GPT_EN			((0 << 2) | BIT1 | BIT0)
> +#define GPT_EN			((0x0 << 2) | (0x1 << 1) | (0x1 << 0))

Why not 0x3 ?

Note: especially the "(0x0 << 2) | " part in the expression i really
bogus.

Best regards,

Wolfgang Denk

-- 
DENX Software Engineering GmbH,     MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de
"No problem is so formidable that you can't walk away from it."
- C. Schulz


More information about the U-Boot mailing list