This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

CCS/MSP430G2452: Multiplying int32 = int16 * int16

Part Number: MSP430G2452

Tool/software: Code Composer Studio

I have the following lines in my code:

struct system_info {
   unsigned int battery_gain;
   int battery_offset;
} SystemInfo;

unsigned int read_battery(void);

return (((unsigned long)read_battery() * SystemInfo.battery_gain) >> 10) + SystemInfo.battery_offset;

When this line is compiled, I get int32 = int32 x int32 multiplication, calling __mpyl in the library.

I tried to follow the instructions in multiplication guide (www.ti.com/.../spra683):

return (((unsigned long)(unsigned int)read_battery() * (unsigned long)(unsigned int)SystemInfo.battery_gain) >> 10) + SystemInfo.battery_offset;

I still get the same multiplication call __mpyl.

How can I use the more efficient multiplication int32 = int16 x int16?