Summary: Power expression optimisation: 2^^unsigned ==>
           Product: D
           Version: D2
          Platform: All
        OS/Version: Windows
            Status: NEW
          Keywords: performance
          Severity: enhancement
          Priority: P2
         Component: DMD

--- Comment #0 from 2011-05-07 05:27:50 PDT ---
Related to bug 5812
I think it's good to have an optimization of 2^^x ==> 1<<x when x is an
unsigned integral or where the compiler can infer x to be a not negative

import std.math; // currently std.math is needed here
int main(string[] args) {
    return 2 ^^ args.length;

Currently it generates:

__Dmain    comdat
L0:        push    EAX
        push    2
        mov    EAX,0Ch[ESP]
        call    near ptr _D3std4math12__T3powTiTkZ3powFNaNbNeikZk
        pop    ECX

Configure issuemail:
------- You are receiving this mail because: -------

Reply via email to