Binary Multiplication in C
Basically your algorithm looks correct, however:


You should use unsigned ints or have some treatment for the signs, otherwise I guess (didn't check it though) that your results for negative numbers will be wrong
Don't test for 0 explicitly, i.e. just write while(m) and if(m &amp; 1)