On Thursday, 6 July 2017 at 08:26:42 UTC, Guillaume Chatelet wrote:
A correct lowering would be:

ubyte[256] data;
for(ubyte i = 0;;++i) {
   ubyte x = data[i];
   ...
   if(i==255) break;
}

That could lead to two branches in machine language, try to think about it in terms of if and do-while loops to mirror typical machine language. The correct lowering is:


ubyte[256] data;

if  (data.length > 0) {
   ubyte i = 0;
   do {
        writeln(i);
    } while ((++i) != cast(ubyte)data.length);
}

Reply via email to