Fast switch statement

John Colvin john.loughran.colvin at gmail.com
Thu Apr 4 02:51:14 PDT 2013


On Thursday, 4 April 2013 at 01:06:45 UTC, Steve Kucera wrote:
> Hi,
>
> I am using DMD 2.062 on Windows 7 64-bit.
>
> I am writing performance critical functions that need switch 
> statements to use an indirect jump table... current I'm 
> analysing the assembly dump, and the code is compiled to nested 
> ifs instead. This happens with switch and final switch. Is 
> there any way to force the compiler to use a jump table?
>
> Steve

Ldc or gdc may be able to do this for you if dmd cannot.

Other than that, the inline asm in dmd is easy enough to use.


More information about the Digitalmars-d-learn mailing list