well i havent downloaded the D language tools yet, so you have to run it and tell us your result. but for starts let us say the limit was 19.
the answer would be 3 + 5 + 6 + 9 + 10 + 12 + 15 + 18 = 78
Code:
public extern(D) uint ChallengeSolution(uint limit)
{
asm
{
naked;
mov ECX, EAX; // store the limit which was in EAX somewhere else
xor EAX, EAX; // set EAX to 0
xor EDX, EDX; // set EDX to 0
X0: // mark where loop should start
add EDX, 15; // set EDX+= 15
cmp EDX, ECX;// some flag = EDX limit
ja X1; // if we can end then break out of the loop
add EAX, EDX;// set EAX+= EDX
jmp X0; // goto the start of the loop
X1:
ret;
}
}
is that equivalent? i dont think it right still.