(int << ulong) == int ?
Dmitry Olshansky
dmitry.olsh at gmail.com
Sun Aug 7 14:42:37 PDT 2011
>
> 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.
--
Dmitry Olshansky
More information about the Digitalmars-d-learn
mailing list