[Issue 3735] op=
d-bugmail at puremagic.com
d-bugmail at puremagic.com
Wed Jan 18 16:31:50 PST 2012
http://d.puremagic.com/issues/show_bug.cgi?id=3735
--- Comment #4 from Stewart Gordon <smjg at iname.com> 2012-01-18 16:31:48 PST ---
(In reply to comment #2)
> Apart from Stewart's comment, there's also the case of >>>.
>
> a >>>= b is different to a = a >>> b, if a is short or byte.
>
> (The first does an unsigned shift, the second does a signed shift).
Oh yes, that crazy abomination that is promotion. Suppose you have
byte a = cast(byte) 0b11110000; // why does it insist on a cast?
a = a >>> 3;
then what actually happens is
0b11110000 >> 3
promote to int
0b1111111111110000 >> 3
apply shift
0b0001111111111110
convert back to a byte
0b11111110
If you shift by 25 or more (17 or more for short), you'll start to see the zero
bits come through.
--
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
More information about the Digitalmars-d-bugs
mailing list