Help me convert this, its easy!!
hello all, I need to convert this code to VB6, could anybody please help me!
its this function:
Code:
#define BITS_PER_CHAR 8
unsigned short updcrc (unsigned short ch, unsigned short crc)
{
register short counter = BITS_PER_CHAR;
register short temp = crc
while (--counter >= 0)
if (temp & 0x8000){
temp <<= 1;
temp += (((ch <<= 1) & 0x0100) != 0);
temp ^= 0x1021;
}
else{
temp <<= 1;
temp += (((ch <<= 1) & 0x0100) != 0);
}
return (temp);
that calls this one:
Code:
#define BITS_PER_CHAR 8
unsigned short updcrc (unsigned short ch, unsigned short crc)
{
register short counter = BITS_PER_CHAR;
register short temp = crc
while (--counter >= 0)
if (temp & 0x8000){
temp <<= 1;
temp += (((ch <<= 1) & 0x0100) != 0);
temp ^= 0x1021;
}
else{
temp <<= 1;
temp += (((ch <<= 1) & 0x0100) != 0);
}
return (temp);