RobDowneyJr
Member
What it says is:
For this lab, we will do multiplication of unsigned integers using integer additions, bitwise shifts, and bit testing.
1. If the multiplier bit is 1, put a copy of the multiplicand in the proper plce and add it to the product or
2. If the multiplier bit is 0, do nothing (add 0 to the product).
for (int i=1; i<=32; i++)
{
If the least significant bit of the multiplier is 1
add multiplicand to the product;
else do nothing;
shift the multiplicand left by 1 bit; //i.e. put it in proper place
shift the multiplier right 1 bit; //so we just need to test the least significant bit
}
your task in this lab is to implement the above algorithm in C++
the compiler reads regular decimal bits in binary i guess but how do i check to see if the least significant bit is 1 or 0?
For this lab, we will do multiplication of unsigned integers using integer additions, bitwise shifts, and bit testing.
1. If the multiplier bit is 1, put a copy of the multiplicand in the proper plce and add it to the product or
2. If the multiplier bit is 0, do nothing (add 0 to the product).
for (int i=1; i<=32; i++)
{
If the least significant bit of the multiplier is 1
add multiplicand to the product;
else do nothing;
shift the multiplicand left by 1 bit; //i.e. put it in proper place
shift the multiplier right 1 bit; //so we just need to test the least significant bit
}
your task in this lab is to implement the above algorithm in C++
the compiler reads regular decimal bits in binary i guess but how do i check to see if the least significant bit is 1 or 0?