Grant Edwards wrote:
uint32_t r;void foo(uint16_t u1, uint16_t u2){ r = (uint32_t)u1 * (uint32_t)u2; }
This will result in a 32x32 Bit Multiplication with the result cropped to 32 Bits.
Try: r = (uint32_t)u1 * u2;Smart compilers will then recognize, that you are demanding a 16x16=>32Bit multiplication. This is a common problem of C-compilers and it is said that most of them recognize it this way.
Ralf
