Hacker News new | ask | show | jobs
by userbinator 526 days ago
I'm nowhere near an APL-level programmer, but that C example already looks ridiculously verbose to me; the body of the loop could be simply written branchlessly as:

    total += !(i&1);
...and since there's another comment here about Asm, I'd compile the above as (assume edx is i and total in eax, high 24 bits of ebx precleared):

    test dl, 1
    setnz bl
    add eax, ebx