> > Hi,
> >
> > Can anyone convert this C code into VFP for me please? Looks like it is supposed to calculate a CRC16 checksum. I know the results it is supposed to give and i have to replicate it. Have tried sys( 2007) and the results are nothing like.
> >
> >
> > static unsigned int crc16(unsigned int val)
> > {
> > unsigned long crc=0,rip;
> > char c;
> >
> > for (c=16; c ; c--){
> > rip=val^crc;
> > val>>=1;
> > crc>>=1;
> > if (rip & 1) crc ^= 0x11021; // polinomio ricavato da XLINK IAR
> > }
> > return crc;
> > }
> >
> >
> > Thanks in advance
> >
> > Richard Clarke
>
>
> FUNCTION CRC16(lnVal)
> LOCAL lnCRC, rip, lnFor
> lnCRC = 0
> FOR lnFor = 16 TO 0 STEP -1
> rip = lnVal ^ lnCRC
> lnCRC = BITRSHIFT(lnCRC,1)
> lnVal = BITRSHIFT(lnVal,1)
> IF BITAND(rip, 1) # 0
> lnCRC = lnCRC ^ 0x11021
> ENDIF
> NEXT
> RETURN lnCRC
>
>
> -----------------
> Borislav Borissov
>
>
Against Stupidity the Gods themselves Contend in Vain - Johann Christoph Friedrich von Schiller>
The only thing normal about database guys is their tables.Hello Borislav,
It always returns zero?
Richard