[Issue 550] Shifting by more bits than size of quantity is allowed

d-bugmail at puremagic.com d-bugmail at puremagic.com
Sat May 12 01:04:27 PDT 2007


http://d.puremagic.com/issues/show_bug.cgi?id=550





------- Comment #3 from deewiant at gmail.com  2007-05-12 03:04 -------
Though the spec doesn't say it, it might as well be worth also disallowing
shifts equal to the size of the quantity, as they just zero the value.

Or, at least, they should: some appear to be no-ops currently. As pointed out
by Thomas Kühne in digitalmars.D.learn (
http://lists.puremagic.com/pipermail/digitalmars-d-learn/2007-May/005040.html
), compile-time shifts should be done by ((shift >= x.sizeof * 8) ? 0 : shift)
instead of the current (shift % (x.sizeof * 8)).


-- 



More information about the Digitalmars-d-bugs mailing list