Every story and comment from the Hacker News API, in a layout borrowed from 2001.
A comment on GodBolt: Enter C, get Assembly. Parent comment
Now here's a more efficient algorithm which does produce the currect result:
int square(int num) { int a = 0; for (int x = 1, n = num; x <= num; x+=x, n+=n) { if( num & x) { a += n; } } return a; }
Now here's a more efficient algorithm which does produce the currect result:
It would be nice if this site allowed us to run/step through the code, to see exactly what it is doing.