EnglishРусский  

   ..

   arr.c

   arr.h

   arrdata.c

   arrdata.h

   buf.c

   buf.h

   crc.c

   crc.h

   file.c

   file.h

   hash.c

   hash.h

   memory.c

   memory.h

   mix.c

   mix.h

   msg.c

   msg.h

   msglist.c

   msglist.g

   msglist.h

   number.c

   number.h

   str.c

   str.h

   types.h

The project is closed! You can look at a new scripting language. It is available on GitHub.
Also, try our open source cross-platform automation software.

Ads

Installer and installation software
Commercial and Freeware installers.

 1 /******************************************************************************
 2 *
 3 * Copyright (C) 2006, The Gentee Group. All rights reserved. 
 4 * This file is part of the Gentee open source project - http://www.gentee.com. 
 5 * 
 6 * THIS FILE IS PROVIDED UNDER THE TERMS OF THE GENTEE LICENSE ("AGREEMENT"). 
 7 * ANY USE, REPRODUCTION OR DISTRIBUTION OF THIS FILE CONSTITUTES RECIPIENTS 
 8 * ACCEPTANCE OF THE AGREEMENT.
 9 *
10 * ID: crc 18.10.06 0.0.A.
11 *
12 * Author: Alexey Krivonogov
13 *
14 * Summary: This file provides calculating CRC32.
15 *
16 ******************************************************************************/
17 
18 #include "crc.h"
19 
20 uint  _crctbl[ 256 ];
21 
22 //--------------------------------------------------------------------------
23 
24 void STDCALL crc_init( void )
25 {
26    uint  reg, polinom, i, ib;
27 
28    polinom = 0xEDB88320;
29    _crctbl[ 0 ] = 0;
30 
31    for ( i = 1; i < 256; i++ )
32    {
33       reg = 0;
34       for ( ib = i | 256; ib != 1; ib >>= 1 )
35       {
36          reg = ( reg & 1 ? (reg >> 1) ^ polinom : reg >> 1 );
37          if ( ib & 1 )
38             reg ^= polinom;
39       }
40       _crctbl[ i ] = reg;
41    }
42 }
43 
44 //--------------------------------------------------------------------------
45 // seed must be 0xFFFFFFFF in the first calling
46 
47 uint STDCALL crc( pubyte data, uint size, uint seed )
48 {
49    while ( size-- )
50       seed = _crctbl[((ushort)seed ^ ( *data++ )) & 0xFF ] ^ ( seed >> 8 );
51 
52    return seed;
53 }
54 
55 //--------------------------------------------------------------------------
56 
57