(int << ulong) == int ?

Jonathan M Davis jmdavisProg at gmx.com
Sun Aug 7 14:47:43 PDT 2011


On Monday 08 August 2011 01:42:37 Dmitry Olshansky wrote:
> > You have to deal with integer promotions and all that when doing
> > arithmetic, because arithmetic needs to be done with a like number of
> > bits on both sides of the operation. But with shifting, all your doing
> > is asking it to shift some number of bits. The type which holds the
> > number of bits shouldn't really matter. I wouldn't expect _any_ integer
> > promotions to occur in a shift expression. If you want to affect what's
> > being shifted, then cast what's being shifted.
> 
> That's right... Somehow it didn't occur to me till the last moment that
> bit shift is asymmetric in nature so it really shouldn't do any promotions.
> Sorry for the noise.

Yeah, well. Similar stuff happens to us all upon occasion. The real problem is 
when it happens frequently

- Jonathan M Davis


More information about the Digitalmars-d-learn mailing list