处理器是F28335 CCSv4
void foo()
{
static uint64_t sum_A;
sum_A = 1326 * 1326;
}
得到的结果不对
而必须对1326 进行强制转换 且 sum_A 必须放到函数外部
处理器核的寄存器是16位的吗? 那sum_A也必须成为全局变量?
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.
处理器是F28335 CCSv4
void foo()
{
static uint64_t sum_A;
sum_A = 1326 * 1326;
}
得到的结果不对
而必须对1326 进行强制转换 且 sum_A 必须放到函数外部
处理器核的寄存器是16位的吗? 那sum_A也必须成为全局变量?
下面追加的问题我没看明白,上面的问题,请这样写:
sum_A = 1326L * 1326L;
L的作用说明如下:
When you initialize a long double to a constant, you must use the l or L suffix. The constant is treated as a
double type without the suffix and the run-time support double-to-long conversion routine is called for the
initialization. This could result in the loss of precision. For example:
long double a = 12.34L; /* correctly initializes to double precision */
long double b = 56.78; /* converts single precision value to double precision */
The formatting rules for long doubles in C I/O require a capital ’L’ in the format string. For example:
printf("%Lg", 1.23L);
printf("%Le", 3.45L);
详情请看一下TMS320C28x Optimizing C C++ Compiler中的说明。