On Mon, 17 Aug 2009 12:44:59 +0200 Jonathan Gray <[email protected]> wrote:
> On Mon, Aug 17, 2009 at 12:09:17PM +0200, Thomas Pfaff wrote: > > On Mon, 17 Aug 2009 01:00:23 +0200 > > Jonathan Gray <[email protected]> wrote: > > > > > /* XXX magic 0x1 */ > > > - test1 |= LSHIFT(0x1, ATW_TEST1_DBGREAD_MASK) | ATW_TEST1_CONTROL; > > > + test1 |= (0x1 << ATW_TEST1_DBGREAD_SHIFT) | ATW_TEST1_CONTROL; > > > > I'm curious, what is the difference between 1 << N and 0x1 << N ? > > Well for example, this line previously expanded to: > > test1 |= ((0x1) << > ((((u_long)(((((((((((((((30))>((28)))?((30)):((28))) + 1) == 32) ? 0 : > ((u_int32_t) 1 << (((((30))>((28)))?((30)):((28))) + 1))) - 1) ^ > ((((((((30))<((28)))?((30)):((28)))) == 32) ? 0 : ((u_int32_t) 1 << > (((((30))<((28)))?((30)):((28)))))) - 1)))) - 1) & [...] Wonderful ;-) However, my question was not why not use the macro but why specify 0x1 rather than just 1. AFAIK there's no difference but the /* XXX magic 0x1 */ comment seem to indicate otherwise and it got me curious, though no big deal. Thomas
