http://d.puremagic.com/issues/show_bug.cgi?id=2809
--- Comment #4 from Don <clugd...@yahoo.com.au> 2010-11-15 15:06:34 PST --- (In reply to comment #3) > Mr Bs test case is wrong: > > static assert((cast(short)-1 >>> 1) == int.max); > > should be: > > static assert((cast(short)-1 >>> 1) == short.max); Not so. You might be thinking of this, which _is_ true: static assert((cast(short)-1 >>> cast(short)1) == short.max); The problem is that >>> interacts badly with implicit type conversions. With every other operator, typeof(short OP int) == int. Possible solutions are: (a) special case for >>> (b) disallow >>> for types smaller than int (c) drop it from the language Personally I think (c) is the only option that makes sense. > unsigned right shift is perfectly well defined, > though giving it it's own operator seems like overkill. > > I think it would be better as a function in std.intrinsic. You don't need it at all. Just cast to unsigned, then >>. >>> is a ridiculous operator. > You aren't going to use unsigned shift unless you know what you doing and care > about performance. -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------