工具/软件:Code Composer Studio
我的代码中有以下行:
struct system_info{
unsigned int battery_gain;
int battery_offset;
}系统信息;
unsigned int read_battery (void);
return (((unsigned long) read_battery ()* SystemInfo.battery_gain)>> 10)+ SystemInfo.battery_offset;
编译此行时、我获取 int32 = int32 x int32乘法、在库中调用__mpyl。
我尝试按照乘法运算指南(www.ti.com/.../spra683):)中的指令操作
返回((unsigned long)(unsigned int) read_battery ()*(unsigned long)(unsigned int) SystemInfo.battery_gain)>> 10)+ SystemInfo.battery_offset;
我仍然得到相同的乘法调用_mpyl。
如何使用更高效的乘法 int32 = int16 x int16?