工具/软件:Code Composer Studio
我在 CLA 协处理器中发现了一个非常奇怪的比较(我知道当操作数的差异溢出时、编译器会出现错误、我认为这不是这里的情况)。 我已经完成了一些测试、结果在注释中(CurrentLimit=-1、DACOffset[1][Phase]= 501):
int16 test1 = 1-501?1:-501; // 1.
int16 test2 =-1>-501?-1:-501; //-1
Int16 test3 =-CurrentLimit>-DACOffset[1][Phase]?-CurrentLimit:-DACOffset[1][Phase]; //-501
Int16 test4 =-CurrentLimit>-DACOffset[1][Phase]; // 0
int16 test5 =(-CurrentLimit>(-DACOffset[1][Phase])?-CurrentLimit:-DACOffset[1][Phase]; //-501
Int16 test6 =(-CurrentLimit>-DACOffset[1][Phase])?-CurrentLimit:-DACOffset[1][Phase]; //-501
int16 test7 =-1;
int16 test8 = 501;
int16 test9 =(-test7)>-test8?(-test7):-test8; //-501
int16 test10 =-test7; // 1.
int16 test11 = test10>-test8?test10:-test8; // 1.
主 CPU 和"Expressions"窗口确实达到了正确的值、在 CLA 中出错。 有什么想法吗?