]> git.saurik.com Git - wxWidgets.git/blob - utils/Install/packace/uac_crc.c
adapted to new sending for radiobutton events for unselecting too
[wxWidgets.git] / utils / Install / packace / uac_crc.c
1 /* ------------------------------------------------------------------------ */
2 /* */
3 /* CRC-calculation routines. */
4 /* */
5 /* ------------------------------------------------------------------------ */
6
7 #include "uac_crc.h"
8
9
10 ULONG crctable[256];
11 ULONG rd_crc=0;
12
13
14 void make_crctable(void) // initializes CRC table
15 {
16 ULONG r,
17 i,
18 j;
19
20 for (i = 0; i <= 255; i++)
21 {
22 for (r = i, j = 8; j; j--)
23 r = (r & 1) ? (r >> 1) ^ CRCPOLY : (r >> 1);
24 crctable[i] = r;
25 }
26 }
27
28 // Updates crc from addr till addr+len-1
29 //
30 ULONG getcrc(ULONG crc, UCHAR * addr, INT len)
31 {
32 while (len--)
33 crc = crctable[(unsigned char) crc ^ (*addr++)] ^ (crc >> 8);
34 return (crc);
35 }
36