Annotation of sbbs/src/smblib/crc32.h, revision 1.1.1.2

1.1       root        1: /* crc32.h */
                      2: 
                      3: /* 32-bit CRC table and calculation macro */
                      4: 
1.1.1.2 ! root        5: /* $Id: crc32.h,v 1.15 2008/06/04 04:39:44 deuce Exp $ */
1.1       root        6: 
                      7: /****************************************************************************
                      8:  * @format.tab-size 4          (Plain Text/Source Code File Header)                    *
                      9:  * @format.use-tabs true       (see http://www.synchro.net/ptsc_hdr.html)              *
                     10:  *                                                                                                                                                     *
                     11:  * Copyright 2003 Rob Swindell - http://www.synchro.net/copyright.html         *
                     12:  *                                                                                                                                                     *
                     13:  * This program is free software; you can redistribute it and/or                       *
                     14:  * modify it under the terms of the GNU General Public License                         *
                     15:  * as published by the Free Software Foundation; either version 2                      *
                     16:  * of the License, or (at your option) any later version.                                      *
                     17:  * See the GNU General Public License for more details: gpl.txt or                     *
                     18:  * http://www.fsf.org/copyleft/gpl.html                                                                                *
                     19:  *                                                                                                                                                     *
                     20:  * Anonymous FTP access to the most recent released source is available at     *
                     21:  * ftp://vert.synchro.net, ftp://cvs.synchro.net and ftp://ftp.synchro.net     *
                     22:  *                                                                                                                                                     *
                     23:  * Anonymous CVS access to the development source and modification history     *
                     24:  * is available at cvs.synchro.net:/cvsroot/sbbs, example:                                     *
                     25:  * cvs -d :pserver:[email protected]:/cvsroot/sbbs login                       *
                     26:  *     (just hit return, no password is necessary)                                                     *
                     27:  * cvs -d :pserver:[email protected]:/cvsroot/sbbs checkout src                *
                     28:  *                                                                                                                                                     *
                     29:  * For Synchronet coding style and modification guidelines, see                                *
                     30:  * http://www.synchro.net/source.html                                                                          *
                     31:  *                                                                                                                                                     *
                     32:  * You are encouraged to submit any modifications (preferably in Unix diff     *
                     33:  * format) via e-mail to [email protected]                                                                      *
                     34:  *                                                                                                                                                     *
                     35:  * Note: If this box doesn't appear square, then you need to fix your tabs.    *
                     36:  ****************************************************************************/
                     37: 
                     38: #ifndef _CRC32_H_
                     39: #define _CRC32_H_
                     40: 
                     41: #include <stdio.h>     /* FILE */
1.1.1.2 ! root       42: #include "gen_defs.h"  /* uint32_t */
1.1       root       43: 
                     44: #ifdef __cplusplus
                     45: extern "C" {
                     46: #endif
                     47: 
1.1.1.2 ! root       48: extern int32_t crc32tbl[];
1.1       root       49: 
1.1.1.2 ! root       50: uint32_t crc32i(uint32_t crc, const char* buf, unsigned long len);
        !            51: uint32_t fcrc32(FILE* fp, unsigned long len);
1.1       root       52: 
                     53: #ifdef __cplusplus
                     54: }
                     55: #endif
                     56: 
                     57: #define ucrc32(ch,crc) (crc32tbl[(crc^(ch))&0xff]^(crc>>8))
1.1.1.2 ! root       58: #define crc32(x,y) crc32i(0xffffffff,x,y)
1.1       root       59: 
                     60: #endif /* Don't add anything after this line */

unix.superglobalmegacorp.com

This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.