K
koobelek
I'm not C/C++ expert and I've been struggling with converting this
piece of code to VB. I would appreciate any help. Thanks.
/*
* uint16 calcBlockCRC(size_t count, uint16 crc, void *buffer)
*
* ARGUMENTS
* size_t count :Number of bytes in the buffer
* uint16 crc : Preload value of the CRC
* void *buffer : Buffer whose CRC is to be calculated
*
* DESCRIPTION
* This routine is called to calculate the CCITT CRC value of a block
of data.
* RETURNS
* CRC value.
*/
uint16 calcBlockCRC(size_t count, uint16 crc, void *buffer)
{
const uint8 *pBuf = (const uint8*)buffer;
while (count--)
crc = (uint16)((crc >> 8) ^ crcTable[(uint8)(crc ^ *pBuf++)]);
return (crc ^ ((uint16)0xFFFF));
}
piece of code to VB. I would appreciate any help. Thanks.
/*
* uint16 calcBlockCRC(size_t count, uint16 crc, void *buffer)
*
* ARGUMENTS
* size_t count :Number of bytes in the buffer
* uint16 crc : Preload value of the CRC
* void *buffer : Buffer whose CRC is to be calculated
*
* DESCRIPTION
* This routine is called to calculate the CCITT CRC value of a block
of data.
* RETURNS
* CRC value.
*/
uint16 calcBlockCRC(size_t count, uint16 crc, void *buffer)
{
const uint8 *pBuf = (const uint8*)buffer;
while (count--)
crc = (uint16)((crc >> 8) ^ crcTable[(uint8)(crc ^ *pBuf++)]);
return (crc ^ ((uint16)0xFFFF));
}