What does this compute, with a and b in Q15?
int32_t p = ((int32_t)a * b) >> 15;
Answer: C
The cast widens the multiplication to thirty-two bits so no precision is lost, and the shift removes the extra fifteen fractional bits. Omitting the cast is the usual bug, since the multiplication would then be done in sixteen bits and overflow.
Please log in or register to report this question.