reflum, On Mon, 2009-08-17 at 13:57 +0200, Thomas Pfaff wrote: > On Mon, 17 Aug 2009 12:44:59 +0200 > Jonathan Gray <j...@goblin.cx> 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 <j...@goblin.cx> 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.
There is no diffrence. However sometimes I use 0x01 to say 'the bit 0 set' (for example in context of flags) and use decimal numers only for numbers. maybe the auther in this case want to say the same thing. -- Philipp. (Rah of PH2) [demime 1.01d removed an attachment of type application/pgp-signature which had a name of signature.asc]