Hope below code snippet may help if you are ok with bitwise operator for addition
int xor, and, temp;
and = x & y;
xor = x ^ y;
while(and != 0 )
{
and <<= 1;
temp = xor ^ and;
and &= xor;
xor = temp;
}
For multiplying a and b add "a" "b" times
unsigned int mult(unsigned int a,unsigned int b)
{
unsigned int counter=0;
unsigned int mult = a;
if(a == 0 || b == 0)
{
return 0;
}
//Optimize if any of the number is power of two then
//Just right shift other with value of this number
while(counter < b )
{
counter = add(counter,1);
mult = add(mult,a);
}
return mult;
}