[Issue 5728] "rol" in core.bitop

d-bugmail at puremagic.com d-bugmail at puremagic.com
Sun Aug 7 11:23:13 PDT 2011


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



--- Comment #4 from bearophile_hugs at eml.cc 2011-08-07 11:23:10 PDT ---
As reference, DMD 2.055head compiles this D2 function:


T rot(T)(T x, int shift) {
    return (x >> shift) | (x << (T.sizeof * 8 - shift));
}
void main() {
  int a = 0b_1111_1111;
  int b = 0b_0000_0010;
  rot(a, b);
}


To (-O -release):

_D4test10__T3rotTiZ3rotFiiZi    comdat
    push    EAX
    mov EAX,8[ESP]
    mov ECX,[ESP]
    sar EAX,CL
    mov ECX,020h
    mov EDX,8[ESP]
    sub ECX,[ESP]
    shl EDX,CL
    or  EAX,EDX
    pop ECX
    ret 4

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