> >
> >
> > 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
O GOD!!!
I always forgot that [^] is not POWER operator but XOR(), Sorry:
FUNCTION CRC16(lnVal)
LOCAL lnCRC, rip, lnFor
lnCRC = 0
FOR lnFor = 16 TO 0 STEP -1
rip = BITXOR(lnVal, lnCRC)
lnCRC = BITRSHIFT(lnCRC,1)
lnVal = BITRSHIFT(lnVal,1)
IF BITAND(rip, 1) # 0
lnCRC = BITXOR(lnCRC, 0x11021)
ENDIF
NEXT
RETURN lnCRC
-----------------
Borislav Borissov
Against Stupidity the Gods themselves Contend in Vain - Johann Christoph Friedrich von SchillerThe only thing normal about database guys is their tables.