Hello everybody! Such a problem: it is necessary to realize the multiplication from the older discharge with a shift to the left.
Here is the part of the code where I "realized" it, but the program displays the wrong result. Tell me where the mistake is, please...
My code:
........
int result;
for (int n=sizeof(int)*2; n; n--){
if ((b>>(n-1))&0x01){
int c=a&a, d=a^a, e;
while(c^(e=c|((c<<1)&d))){
c=e;
}
result=(c<<1)^d;
result=result<<1;
result=result+a;
}else {
result=result<<1;
}
}
cout<<"##########\n"<<result<<endl;
.........