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



--- Comment #8 from Don <clugd...@yahoo.com.au> 2012-03-20 01:42:17 PDT ---
(In reply to comment #7)
> I initially thought something along the same lines and tried it on a single
> statement like so:
> 
> x = (cast(unit)((x&0xCCCC_CCCC)>>2)) + (x&0x3333_3333);

That wouldn't work, you have to cast before the shift happens.

x = ((cast(unit)(x&0xCCCC_CCCC))>>2) + (x&0x3333_3333);

Was this on a 64 bit system? (If it was on Windows, we can rule out this theory
entirely).

> 
> No dice.
> 
> DMD throws on every Hex literal in druntime/phobos,

What do you mean by that? Do you mean, generates an internal compiler error?
Can't reproduce that.

> regardless of usage; hence
> the cast(unit) sitting directly in front of the literal itself. Based on the
> debugging info that I see, it looks like DMD is internally creating int's out
> of hex literals somewhere.

Hex literals are supposed to be ints, not uints. The code should work anyway,
because x is a uint, therefore (x & LITERAL) is of type uint.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------

Reply via email to