[Issue 5728] "rol" in core.bitop

d-bugmail at puremagic.com d-bugmail at puremagic.com
Tue Aug 9 17:34:56 PDT 2011


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



--- Comment #5 from Walter Bright <bugzilla at digitalmars.com> 2011-08-09 17:34:51 PDT ---
(In reply to comment #4)
> As reference, DMD 2.055head compiles this D2 function:
> T rot(T)(T x, int shift) {
>     return (x >> shift) | (x << (T.sizeof * 8 - shift));
> }

The mistake is this is not a correct rotate function. (x >> shift) is a signed
right shift. Rewrite as (x >>> shift).

-- 
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