Inndy says to YSITD function mul(a, b) { var sum = 0; while(a) { if(a & 1) { sum += b; } b <<= 1; a >>= 1; } return sum; }