Unrolling loops
Robert Fraser
fraserofthenight at gmail.com
Mon Mar 10 17:29:36 PDT 2008
Simen Kjaeraas wrote:
> Is it possible to unroll loops in D2.0? I have a templated struct with a static array with length set through a template parameter. Does that get automatically unrolled with 4 elements (I doubt it), do I have to use some magic string mixin, or could I fix this with tuples and their automatic loop unrolling?
>
> Actually, that latter one is worth a question of its own. Can I convert a static array into a tuplem and if so, how?
>
> -- Simen
If the compiler knows it to be 4 elements at the code generation stage
(which it will if it's a static array - template resolution is done in
the semantic pass, so it doesn't matter if it's from a template or coded
directly in), it should probably unroll it. Check the assembly.
More information about the Digitalmars-d-learn
mailing list