Can anyone translate this form C to VB please

T

Tosch

Thanks anyone for helping me out in translating this code snippet to
VB.

typedef unsigned int WORD;
typedef unsigned char BYTE;
typedef union
{
WORD w;
struct
{
BYTE lo,hi;
} b;
} BYTEWORD;

WORD ComputeCRC16(char *msg, int len)
{
BYTEWORD chksum;
unsigned char *msgchk;

chksum.w = 0xFFFF;
msgchk = (unsigned char *) msg;

while (len--)
{
chksum.w = chksum.b.hi ^ (ccittrev_tbl[chksum.b.lo^*msgchk++]);
}

chksum.w = ~chksum.w;
return(chksum.w);
}
 
T

Tosch

I know this but I have to translate this code to work together with a
device that calculates a checksum like this C code.

Tosch
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top