1/* 2 Copyright (c) 1990-2008 Info-ZIP. All rights reserved. 3 4 See the accompanying file LICENSE, version 2000-Apr-09 or later 5 (the contents of which are also included in zip.h) for terms of use. 6 If, for some reason, all these files are missing, the Info-ZIP license 7 also may be found at: ftp://ftp.info-zip.org/pub/infozip/license.html 8*/ 9/* crc32.h -- compute the CRC-32 of a data stream 10 * Copyright (C) 1995 Mark Adler 11 * For conditions of distribution and use, see copyright notice in zlib.h 12 */ 13 14#ifndef __crc32_h 15#define __crc32_h /* identifies this source module */ 16 17/* This header should be read AFTER zip.h resp. unzip.h 18 * (the latter with UNZIP_INTERNAL defined...). 19 */ 20 21#ifndef OF 22# define OF(a) a 23#endif 24#ifndef ZCONST 25# define ZCONST const 26#endif 27 28#ifdef DYNALLOC_CRCTAB 29 void free_crc_table OF((void)); 30#endif 31#ifndef USE_ZLIB 32 ZCONST ulg near *get_crc_table OF((void)); 33#endif 34#if (defined(USE_ZLIB) || defined(CRC_TABLE_ONLY)) 35# ifdef IZ_CRC_BE_OPTIMIZ 36# undef IZ_CRC_BE_OPTIMIZ 37# endif 38#else /* !(USE_ZLIB || CRC_TABLE_ONLY) */ 39 ulg crc32 OF((ulg crc, ZCONST uch *buf, extent len)); 40#endif /* ?(USE_ZLIB || CRC_TABLE_ONLY) */ 41 42#ifndef CRC_32_TAB 43# define CRC_32_TAB crc_32_tab 44#endif 45 46#ifdef CRC32 47# undef CRC32 48#endif 49#ifdef IZ_CRC_BE_OPTIMIZ 50# define CRC32UPD(c, crctab) (crctab[((c) >> 24)] ^ ((c) << 8)) 51# define CRC32(c, b, crctab) (crctab[(((int)(c) >> 24) ^ (b))] ^ ((c) << 8)) 52# define REV_BE(w) (((w)>>24)+(((w)>>8)&0xff00)+ \ 53 (((w)&0xff00)<<8)+(((w)&0xff)<<24)) 54#else 55# define CRC32UPD(c, crctab) (crctab[((int)(c)) & 0xff] ^ ((c) >> 8)) 56# define CRC32(c, b, crctab) (crctab[((int)(c) ^ (b)) & 0xff] ^ ((c) >> 8)) 57# define REV_BE(w) w 58#endif 59 60#endif /* !__crc32_h */ 61