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.

CCS4 遇到的怪現像

Code Composer Studio

Version: 4.1.2.00027



void GetBytes(DWORD Value, BYTE* Buf, int StartIndex)

{
    Buf[StartIndex + 0] = (Value >> 0x00) & 0x00FF;
    Buf[StartIndex + 1] = (Value >> 0x08) & 0x00FF;
    Buf[StartIndex + 2] = (Value >> 0x10) & 0x00FF;
    Buf[StartIndex + 3] = (Value >> 0x18) & 0x00FF;
}

這樣的一個 Function, 把 unsigned long 轉成 4 個 BYTE
在 Function 內 Print 結果都很正常


但是 return 之後 Print 出來會發現 Buf[StartIndex + 2] 的內容變成了另外一個值, 而且還大於 0x00FF
如 Input Value = 0xFFFFFFDC , StartIndex = 0,  OutBut  Buf[0]= 0xDC, Buf[1] = 0xFF, Buf[2] = 0x42DF, Buf[3] = 0xFF
若 StartIndex != 0 , 則 Buf[StartIndex + 2] 還是不正常。

請問一下這是 CCS 的 Bug 嗎?

Thanks.