So 16 x 16 gives 16. 32 x 16 gives 32.

In assembly language, we extended the basic '8-bit x 8-bit' multiply instruction of ATmega32A to accomplish multiplication of other higher data sizes through the process of shift and addition.

Based on your post, I performed few simple exercises (given below), and I have come to understand that the

casting what you have said

forcing provides the required result through the same process of shift and addition. Many many thanks for explaining the issue in a simple language.

`//0x7123 * 0xA678 = 0x4991 BA68`

uint16_t z1 = 0x7123;

uint16_t z2 = 0xA678;

uint32_t z3 = z1*z2;

Serial.println (z3, HEX); //prints: BA68 (Correct!)

Now, forcing the Compiler/MCU to produce full 32-bit result through

casting`uint32_t z3 = (uint32_t) z1*z2;`

Serial.println (z3, HEX); //prints: 4991BA68 (Correct!)

As a matter of curiosity, I performed the above multiplication process using

do-while loop (repetitive additions) where I declared the data size of the destination as 32-bit long. I found correct result. (When using * operator for multiplication, we need casting; + operator does not require it!)

`//0x7123 * 0xA678 = 0x4991 BA68`

uint16_t z1 = 0x7123;

uint16_t z2 = 0xA678;

uint32_t z3 = 0;

do

{

z3 = z3 + z1;

z2--;

}

while (z2 != 0);

Serial.println(z3, HEX); //prints: 4991BA68 (Correct!)