Russian Peasant Multiplication
Here is my short implementation of Russian Peasant Multiplication . How can it be improved? Restrictions : only works when a>0,b>0 for(p=0;p+=(a&1)*b,a!=1;a>>=1,b<<=1); Svante It can be improved by adding whitespace, proper indentation, and a proper function body: int peasant_mult (int a, int b) { for (p = 0; p += (a & 1) * b, a != 1; a /= 2, b *= 2); return p;} See? Now it's clear how the three parts of the for declaration are used. Remember, programs are written mainly for human eyes. Unreadable code is always bad code. And now, for my personal amusement, a tail recursive version: (defun