int16 lmul(int b1,int b2)
{
int i,j;
int byte_array[8]; // He cambiado el tipo base del array,no necesitas que sea de 16 bits
int16 aux;
if ((b1 == 0) || (b2 == 0)) //si b1 o b2 vale 0
{
return 0; //devolver de inmediato un 0
}
else
{ // principio else
for(i=0;i<=7;i++)
{
if (bit_test(b1,i)==1)
{
byte_array[i] = b2;
}
else
{
byte_array[i] = 0;
}
}
aux = (int16)byte_array[0];
for(i=1;i<=7;i++)
{
aux = aux + (int16)(byte_array[i]*(2^i)); // Suma cada elemento desplazado y convertido a 16 bits
}
} //fin else
return aux;
}