home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
rtsi.com
/
2014.01.www.rtsi.com.tar
/
www.rtsi.com
/
OS9
/
OSK
/
TELECOM
/
stg_v4.lzh
/
crc.c
< prev
next >
Wrap
C/C++ Source or Header
|
1994-11-11
|
556b
|
35 lines
/* OS9 Standard CRC function */
#include "stglib.h"
#ifndef _OS9
crc(start,size,sum)
unsigned char *start,*sum;
int size;
{
if (!start) crcfb(0,sum);
else
while (size--) crcfb(*(start++),sum);
}
crcfb(byt,sum)
unsigned char byt;
int *sum;
{
register unsigned char sav;
sav=byt^((*sum>>16)&0xff);
*sum<<=8;
*sum&=0xffff00;
*sum^=sav<<1;
*sum^=sav<<6;
if ( (sav>>7)&1 ^ (sav>>6)&1 ^ (sav>>5)&1 ^ (sav>>4)&1
^ (sav>>3)&1 ^ (sav>>2)&1 ^ (sav>>1)&1 ^ sav&1 )
*sum^=0x800021;
*sum|=0xff000000;
}
#endif