Tool/software: TI C/C++ Compiler
Hi,
I develop DSP applications (C64x+) under DVSDK 4.00.00.22 (xdctools 3.16.03.36) for the Mistral EVM3530 board and I got the following warning about an unsigned int (32 bits) but this should not appears because it is unsigned
//Relate to CRC
#define POLYNOMIAL 0x1021
#define INITIAL_Remainder 0xFFFF
#define FINAL_XOR_VALUE 0x0000
#define WIDTH (8 * sizeof(width))
#define TOPBIT (1 << (WIDTH - 1))
typedef unsigned long width;
typedef unsigned char byte;
width crcTable[256];
void initCRC(void)
{
unsigned short Remainder;
unsigned short dividend; // Divide 16bit CRC by 4bit
int bit;
for (dividend = 0; dividend < 256; dividend++)
{
Remainder = dividend << (WIDTH - 8);
for (bit = 0; bit < 8; bit++)
{
if(Remainder & TOPBIT) <------Error Point
Remainder = (Remainder << 1) ^ POLYNOMIAL;
else
Remainder = Remainder << 1;
}
crcTable[dividend] = Remainder;
}
}
unsigned short calcurateCRC(unsigned char *message, unsigned int nBytes)
{
unsigned int offset;
unsigned char byte;
unsigned short Remainder = INITIAL_Remainder;
for (offset = 0; offset < nBytes; offset++)
{
byte = (Remainder >> (WIDTH - 8)) ^ message[offset];
Remainder = crcTable[byte] ^ (Remainder << 8);
}
return (Remainder ^ FINAL_XOR_VALUE);
}
unsigned short MakeCRC16(unsigned char *sData, int iDataLen)
{
unsigned short crc16;
initCRC();
crc16 = calcurateCRC(sData, iDataLen);
return (crc16);
}
I did a search on Ti forum about it but not find answer.
What should I do to avoid this false warning? Should remove all sign conversion checking if this option exist?
Thank you,
Lee