Home | History | Annotate | Line # | Download | only in zlib
crc32.c revision 1.1.1.2
      1      1.1  christos /* crc32.c -- compute the CRC-32 of a data stream
      2  1.1.1.2  christos  * Copyright (C) 1995-2006, 2010, 2011, 2012, 2016 Mark Adler
      3      1.1  christos  * For conditions of distribution and use, see copyright notice in zlib.h
      4      1.1  christos  *
      5      1.1  christos  * Thanks to Rodney Brown <rbrown64 (at) csc.com.au> for his contribution of faster
      6      1.1  christos  * CRC methods: exclusive-oring 32 bits of data at a time, and pre-computing
      7      1.1  christos  * tables for updating the shift register in one step with three exclusive-ors
      8      1.1  christos  * instead of four steps with four exclusive-ors.  This results in about a
      9      1.1  christos  * factor of two increase in speed on a Power PC G4 (PPC7455) using gcc -O3.
     10      1.1  christos  */
     11      1.1  christos 
     12      1.1  christos /* @(#) Id: crc32.c,v 1.1.1.2 2002/03/11 21:53:23 tromey Exp  */
     13      1.1  christos 
     14      1.1  christos /*
     15      1.1  christos   Note on the use of DYNAMIC_CRC_TABLE: there is no mutex or semaphore
     16      1.1  christos   protection on the static variables used to control the first-use generation
     17      1.1  christos   of the crc tables.  Therefore, if you #define DYNAMIC_CRC_TABLE, you should
     18      1.1  christos   first call get_crc_table() to initialize the tables before allowing more than
     19      1.1  christos   one thread to use crc32().
     20      1.1  christos 
     21      1.1  christos   DYNAMIC_CRC_TABLE and MAKECRCH can be #defined to write out crc32.h.
     22      1.1  christos  */
     23      1.1  christos 
     24      1.1  christos #ifdef MAKECRCH
     25      1.1  christos #  include <stdio.h>
     26      1.1  christos #  ifndef DYNAMIC_CRC_TABLE
     27      1.1  christos #    define DYNAMIC_CRC_TABLE
     28      1.1  christos #  endif /* !DYNAMIC_CRC_TABLE */
     29      1.1  christos #endif /* MAKECRCH */
     30      1.1  christos 
     31      1.1  christos #include "zutil.h"      /* for STDC and FAR definitions */
     32      1.1  christos 
     33      1.1  christos /* Definitions for doing the crc four data bytes at a time. */
     34      1.1  christos #if !defined(NOBYFOUR) && defined(Z_U4)
     35      1.1  christos #  define BYFOUR
     36      1.1  christos #endif
     37      1.1  christos #ifdef BYFOUR
     38      1.1  christos    local unsigned long crc32_little OF((unsigned long,
     39  1.1.1.2  christos                         const unsigned char FAR *, z_size_t));
     40      1.1  christos    local unsigned long crc32_big OF((unsigned long,
     41  1.1.1.2  christos                         const unsigned char FAR *, z_size_t));
     42      1.1  christos #  define TBLS 8
     43      1.1  christos #else
     44      1.1  christos #  define TBLS 1
     45      1.1  christos #endif /* BYFOUR */
     46      1.1  christos 
     47      1.1  christos /* Local functions for crc concatenation */
     48      1.1  christos local unsigned long gf2_matrix_times OF((unsigned long *mat,
     49      1.1  christos                                          unsigned long vec));
     50      1.1  christos local void gf2_matrix_square OF((unsigned long *square, unsigned long *mat));
     51      1.1  christos local uLong crc32_combine_ OF((uLong crc1, uLong crc2, z_off64_t len2));
     52      1.1  christos 
     53      1.1  christos 
     54      1.1  christos #ifdef DYNAMIC_CRC_TABLE
     55      1.1  christos 
     56      1.1  christos local volatile int crc_table_empty = 1;
     57      1.1  christos local z_crc_t FAR crc_table[TBLS][256];
     58      1.1  christos local void make_crc_table OF((void));
     59      1.1  christos #ifdef MAKECRCH
     60      1.1  christos    local void write_table OF((FILE *, const z_crc_t FAR *));
     61      1.1  christos #endif /* MAKECRCH */
     62      1.1  christos /*
     63      1.1  christos   Generate tables for a byte-wise 32-bit CRC calculation on the polynomial:
     64      1.1  christos   x^32+x^26+x^23+x^22+x^16+x^12+x^11+x^10+x^8+x^7+x^5+x^4+x^2+x+1.
     65      1.1  christos 
     66      1.1  christos   Polynomials over GF(2) are represented in binary, one bit per coefficient,
     67      1.1  christos   with the lowest powers in the most significant bit.  Then adding polynomials
     68      1.1  christos   is just exclusive-or, and multiplying a polynomial by x is a right shift by
     69      1.1  christos   one.  If we call the above polynomial p, and represent a byte as the
     70      1.1  christos   polynomial q, also with the lowest power in the most significant bit (so the
     71      1.1  christos   byte 0xb1 is the polynomial x^7+x^3+x+1), then the CRC is (q*x^32) mod p,
     72      1.1  christos   where a mod b means the remainder after dividing a by b.
     73      1.1  christos 
     74      1.1  christos   This calculation is done using the shift-register method of multiplying and
     75      1.1  christos   taking the remainder.  The register is initialized to zero, and for each
     76      1.1  christos   incoming bit, x^32 is added mod p to the register if the bit is a one (where
     77      1.1  christos   x^32 mod p is p+x^32 = x^26+...+1), and the register is multiplied mod p by
     78      1.1  christos   x (which is shifting right by one and adding x^32 mod p if the bit shifted
     79      1.1  christos   out is a one).  We start with the highest power (least significant bit) of
     80      1.1  christos   q and repeat for all eight bits of q.
     81      1.1  christos 
     82      1.1  christos   The first table is simply the CRC of all possible eight bit values.  This is
     83      1.1  christos   all the information needed to generate CRCs on data a byte at a time for all
     84      1.1  christos   combinations of CRC register values and incoming bytes.  The remaining tables
     85      1.1  christos   allow for word-at-a-time CRC calculation for both big-endian and little-
     86      1.1  christos   endian machines, where a word is four bytes.
     87      1.1  christos */
     88      1.1  christos local void make_crc_table()
     89      1.1  christos {
     90      1.1  christos     z_crc_t c;
     91      1.1  christos     int n, k;
     92      1.1  christos     z_crc_t poly;                       /* polynomial exclusive-or pattern */
     93      1.1  christos     /* terms of polynomial defining this crc (except x^32): */
     94      1.1  christos     static volatile int first = 1;      /* flag to limit concurrent making */
     95      1.1  christos     static const unsigned char p[] = {0,1,2,4,5,7,8,10,11,12,16,22,23,26};
     96      1.1  christos 
     97      1.1  christos     /* See if another task is already doing this (not thread-safe, but better
     98      1.1  christos        than nothing -- significantly reduces duration of vulnerability in
     99      1.1  christos        case the advice about DYNAMIC_CRC_TABLE is ignored) */
    100      1.1  christos     if (first) {
    101      1.1  christos         first = 0;
    102      1.1  christos 
    103      1.1  christos         /* make exclusive-or pattern from polynomial (0xedb88320UL) */
    104      1.1  christos         poly = 0;
    105      1.1  christos         for (n = 0; n < (int)(sizeof(p)/sizeof(unsigned char)); n++)
    106      1.1  christos             poly |= (z_crc_t)1 << (31 - p[n]);
    107      1.1  christos 
    108      1.1  christos         /* generate a crc for every 8-bit value */
    109      1.1  christos         for (n = 0; n < 256; n++) {
    110      1.1  christos             c = (z_crc_t)n;
    111      1.1  christos             for (k = 0; k < 8; k++)
    112      1.1  christos                 c = c & 1 ? poly ^ (c >> 1) : c >> 1;
    113      1.1  christos             crc_table[0][n] = c;
    114      1.1  christos         }
    115      1.1  christos 
    116      1.1  christos #ifdef BYFOUR
    117      1.1  christos         /* generate crc for each value followed by one, two, and three zeros,
    118      1.1  christos            and then the byte reversal of those as well as the first table */
    119      1.1  christos         for (n = 0; n < 256; n++) {
    120      1.1  christos             c = crc_table[0][n];
    121      1.1  christos             crc_table[4][n] = ZSWAP32(c);
    122      1.1  christos             for (k = 1; k < 4; k++) {
    123      1.1  christos                 c = crc_table[0][c & 0xff] ^ (c >> 8);
    124      1.1  christos                 crc_table[k][n] = c;
    125      1.1  christos                 crc_table[k + 4][n] = ZSWAP32(c);
    126      1.1  christos             }
    127      1.1  christos         }
    128      1.1  christos #endif /* BYFOUR */
    129      1.1  christos 
    130      1.1  christos         crc_table_empty = 0;
    131      1.1  christos     }
    132      1.1  christos     else {      /* not first */
    133      1.1  christos         /* wait for the other guy to finish (not efficient, but rare) */
    134      1.1  christos         while (crc_table_empty)
    135      1.1  christos             ;
    136      1.1  christos     }
    137      1.1  christos 
    138      1.1  christos #ifdef MAKECRCH
    139      1.1  christos     /* write out CRC tables to crc32.h */
    140      1.1  christos     {
    141      1.1  christos         FILE *out;
    142      1.1  christos 
    143      1.1  christos         out = fopen("crc32.h", "w");
    144      1.1  christos         if (out == NULL) return;
    145      1.1  christos         fprintf(out, "/* crc32.h -- tables for rapid CRC calculation\n");
    146      1.1  christos         fprintf(out, " * Generated automatically by crc32.c\n */\n\n");
    147      1.1  christos         fprintf(out, "local const z_crc_t FAR ");
    148      1.1  christos         fprintf(out, "crc_table[TBLS][256] =\n{\n  {\n");
    149      1.1  christos         write_table(out, crc_table[0]);
    150      1.1  christos #  ifdef BYFOUR
    151      1.1  christos         fprintf(out, "#ifdef BYFOUR\n");
    152      1.1  christos         for (k = 1; k < 8; k++) {
    153      1.1  christos             fprintf(out, "  },\n  {\n");
    154      1.1  christos             write_table(out, crc_table[k]);
    155      1.1  christos         }
    156      1.1  christos         fprintf(out, "#endif\n");
    157      1.1  christos #  endif /* BYFOUR */
    158      1.1  christos         fprintf(out, "  }\n};\n");
    159      1.1  christos         fclose(out);
    160      1.1  christos     }
    161      1.1  christos #endif /* MAKECRCH */
    162      1.1  christos }
    163      1.1  christos 
    164      1.1  christos #ifdef MAKECRCH
    165      1.1  christos local void write_table(out, table)
    166      1.1  christos     FILE *out;
    167      1.1  christos     const z_crc_t FAR *table;
    168      1.1  christos {
    169      1.1  christos     int n;
    170      1.1  christos 
    171      1.1  christos     for (n = 0; n < 256; n++)
    172      1.1  christos         fprintf(out, "%s0x%08lxUL%s", n % 5 ? "" : "    ",
    173      1.1  christos                 (unsigned long)(table[n]),
    174      1.1  christos                 n == 255 ? "\n" : (n % 5 == 4 ? ",\n" : ", "));
    175      1.1  christos }
    176      1.1  christos #endif /* MAKECRCH */
    177      1.1  christos 
    178      1.1  christos #else /* !DYNAMIC_CRC_TABLE */
    179      1.1  christos /* ========================================================================
    180      1.1  christos  * Tables of CRC-32s of all single-byte values, made by make_crc_table().
    181      1.1  christos  */
    182      1.1  christos #include "crc32.h"
    183      1.1  christos #endif /* DYNAMIC_CRC_TABLE */
    184      1.1  christos 
    185      1.1  christos /* =========================================================================
    186      1.1  christos  * This function can be used by asm versions of crc32()
    187      1.1  christos  */
    188      1.1  christos const z_crc_t FAR * ZEXPORT get_crc_table()
    189      1.1  christos {
    190      1.1  christos #ifdef DYNAMIC_CRC_TABLE
    191      1.1  christos     if (crc_table_empty)
    192      1.1  christos         make_crc_table();
    193      1.1  christos #endif /* DYNAMIC_CRC_TABLE */
    194      1.1  christos     return (const z_crc_t FAR *)crc_table;
    195      1.1  christos }
    196      1.1  christos 
    197      1.1  christos /* ========================================================================= */
    198      1.1  christos #define DO1 crc = crc_table[0][((int)crc ^ (*buf++)) & 0xff] ^ (crc >> 8)
    199      1.1  christos #define DO8 DO1; DO1; DO1; DO1; DO1; DO1; DO1; DO1
    200      1.1  christos 
    201      1.1  christos /* ========================================================================= */
    202  1.1.1.2  christos unsigned long ZEXPORT crc32_z(crc, buf, len)
    203      1.1  christos     unsigned long crc;
    204      1.1  christos     const unsigned char FAR *buf;
    205  1.1.1.2  christos     z_size_t len;
    206      1.1  christos {
    207      1.1  christos     if (buf == Z_NULL) return 0UL;
    208      1.1  christos 
    209      1.1  christos #ifdef DYNAMIC_CRC_TABLE
    210      1.1  christos     if (crc_table_empty)
    211      1.1  christos         make_crc_table();
    212      1.1  christos #endif /* DYNAMIC_CRC_TABLE */
    213      1.1  christos 
    214      1.1  christos #ifdef BYFOUR
    215      1.1  christos     if (sizeof(void *) == sizeof(ptrdiff_t)) {
    216      1.1  christos         z_crc_t endian;
    217      1.1  christos 
    218      1.1  christos         endian = 1;
    219      1.1  christos         if (*((unsigned char *)(&endian)))
    220      1.1  christos             return crc32_little(crc, buf, len);
    221      1.1  christos         else
    222      1.1  christos             return crc32_big(crc, buf, len);
    223      1.1  christos     }
    224      1.1  christos #endif /* BYFOUR */
    225      1.1  christos     crc = crc ^ 0xffffffffUL;
    226      1.1  christos     while (len >= 8) {
    227      1.1  christos         DO8;
    228      1.1  christos         len -= 8;
    229      1.1  christos     }
    230      1.1  christos     if (len) do {
    231      1.1  christos         DO1;
    232      1.1  christos     } while (--len);
    233      1.1  christos     return crc ^ 0xffffffffUL;
    234      1.1  christos }
    235      1.1  christos 
    236  1.1.1.2  christos /* ========================================================================= */
    237  1.1.1.2  christos unsigned long ZEXPORT crc32(crc, buf, len)
    238  1.1.1.2  christos     unsigned long crc;
    239  1.1.1.2  christos     const unsigned char FAR *buf;
    240  1.1.1.2  christos     uInt len;
    241  1.1.1.2  christos {
    242  1.1.1.2  christos     return crc32_z(crc, buf, len);
    243  1.1.1.2  christos }
    244  1.1.1.2  christos 
    245      1.1  christos #ifdef BYFOUR
    246      1.1  christos 
    247  1.1.1.2  christos /*
    248  1.1.1.2  christos    This BYFOUR code accesses the passed unsigned char * buffer with a 32-bit
    249  1.1.1.2  christos    integer pointer type. This violates the strict aliasing rule, where a
    250  1.1.1.2  christos    compiler can assume, for optimization purposes, that two pointers to
    251  1.1.1.2  christos    fundamentally different types won't ever point to the same memory. This can
    252  1.1.1.2  christos    manifest as a problem only if one of the pointers is written to. This code
    253  1.1.1.2  christos    only reads from those pointers. So long as this code remains isolated in
    254  1.1.1.2  christos    this compilation unit, there won't be a problem. For this reason, this code
    255  1.1.1.2  christos    should not be copied and pasted into a compilation unit in which other code
    256  1.1.1.2  christos    writes to the buffer that is passed to these routines.
    257  1.1.1.2  christos  */
    258  1.1.1.2  christos 
    259      1.1  christos /* ========================================================================= */
    260      1.1  christos #define DOLIT4 c ^= *buf4++; \
    261      1.1  christos         c = crc_table[3][c & 0xff] ^ crc_table[2][(c >> 8) & 0xff] ^ \
    262      1.1  christos             crc_table[1][(c >> 16) & 0xff] ^ crc_table[0][c >> 24]
    263      1.1  christos #define DOLIT32 DOLIT4; DOLIT4; DOLIT4; DOLIT4; DOLIT4; DOLIT4; DOLIT4; DOLIT4
    264      1.1  christos 
    265      1.1  christos /* ========================================================================= */
    266      1.1  christos local unsigned long crc32_little(crc, buf, len)
    267      1.1  christos     unsigned long crc;
    268      1.1  christos     const unsigned char FAR *buf;
    269  1.1.1.2  christos     z_size_t len;
    270      1.1  christos {
    271      1.1  christos     register z_crc_t c;
    272      1.1  christos     register const z_crc_t FAR *buf4;
    273      1.1  christos 
    274      1.1  christos     c = (z_crc_t)crc;
    275      1.1  christos     c = ~c;
    276      1.1  christos     while (len && ((ptrdiff_t)buf & 3)) {
    277      1.1  christos         c = crc_table[0][(c ^ *buf++) & 0xff] ^ (c >> 8);
    278      1.1  christos         len--;
    279      1.1  christos     }
    280      1.1  christos 
    281      1.1  christos     buf4 = (const z_crc_t FAR *)(const void FAR *)buf;
    282      1.1  christos     while (len >= 32) {
    283      1.1  christos         DOLIT32;
    284      1.1  christos         len -= 32;
    285      1.1  christos     }
    286      1.1  christos     while (len >= 4) {
    287      1.1  christos         DOLIT4;
    288      1.1  christos         len -= 4;
    289      1.1  christos     }
    290      1.1  christos     buf = (const unsigned char FAR *)buf4;
    291      1.1  christos 
    292      1.1  christos     if (len) do {
    293      1.1  christos         c = crc_table[0][(c ^ *buf++) & 0xff] ^ (c >> 8);
    294      1.1  christos     } while (--len);
    295      1.1  christos     c = ~c;
    296      1.1  christos     return (unsigned long)c;
    297      1.1  christos }
    298      1.1  christos 
    299      1.1  christos /* ========================================================================= */
    300  1.1.1.2  christos #define DOBIG4 c ^= *buf4++; \
    301      1.1  christos         c = crc_table[4][c & 0xff] ^ crc_table[5][(c >> 8) & 0xff] ^ \
    302      1.1  christos             crc_table[6][(c >> 16) & 0xff] ^ crc_table[7][c >> 24]
    303      1.1  christos #define DOBIG32 DOBIG4; DOBIG4; DOBIG4; DOBIG4; DOBIG4; DOBIG4; DOBIG4; DOBIG4
    304      1.1  christos 
    305      1.1  christos /* ========================================================================= */
    306      1.1  christos local unsigned long crc32_big(crc, buf, len)
    307      1.1  christos     unsigned long crc;
    308      1.1  christos     const unsigned char FAR *buf;
    309  1.1.1.2  christos     z_size_t len;
    310      1.1  christos {
    311      1.1  christos     register z_crc_t c;
    312      1.1  christos     register const z_crc_t FAR *buf4;
    313      1.1  christos 
    314      1.1  christos     c = ZSWAP32((z_crc_t)crc);
    315      1.1  christos     c = ~c;
    316      1.1  christos     while (len && ((ptrdiff_t)buf & 3)) {
    317      1.1  christos         c = crc_table[4][(c >> 24) ^ *buf++] ^ (c << 8);
    318      1.1  christos         len--;
    319      1.1  christos     }
    320      1.1  christos 
    321      1.1  christos     buf4 = (const z_crc_t FAR *)(const void FAR *)buf;
    322      1.1  christos     while (len >= 32) {
    323      1.1  christos         DOBIG32;
    324      1.1  christos         len -= 32;
    325      1.1  christos     }
    326      1.1  christos     while (len >= 4) {
    327      1.1  christos         DOBIG4;
    328      1.1  christos         len -= 4;
    329      1.1  christos     }
    330      1.1  christos     buf = (const unsigned char FAR *)buf4;
    331      1.1  christos 
    332      1.1  christos     if (len) do {
    333      1.1  christos         c = crc_table[4][(c >> 24) ^ *buf++] ^ (c << 8);
    334      1.1  christos     } while (--len);
    335      1.1  christos     c = ~c;
    336      1.1  christos     return (unsigned long)(ZSWAP32(c));
    337      1.1  christos }
    338      1.1  christos 
    339      1.1  christos #endif /* BYFOUR */
    340      1.1  christos 
    341      1.1  christos #define GF2_DIM 32      /* dimension of GF(2) vectors (length of CRC) */
    342      1.1  christos 
    343      1.1  christos /* ========================================================================= */
    344      1.1  christos local unsigned long gf2_matrix_times(mat, vec)
    345      1.1  christos     unsigned long *mat;
    346      1.1  christos     unsigned long vec;
    347      1.1  christos {
    348      1.1  christos     unsigned long sum;
    349      1.1  christos 
    350      1.1  christos     sum = 0;
    351      1.1  christos     while (vec) {
    352      1.1  christos         if (vec & 1)
    353      1.1  christos             sum ^= *mat;
    354      1.1  christos         vec >>= 1;
    355      1.1  christos         mat++;
    356      1.1  christos     }
    357      1.1  christos     return sum;
    358      1.1  christos }
    359      1.1  christos 
    360      1.1  christos /* ========================================================================= */
    361      1.1  christos local void gf2_matrix_square(square, mat)
    362      1.1  christos     unsigned long *square;
    363      1.1  christos     unsigned long *mat;
    364      1.1  christos {
    365      1.1  christos     int n;
    366      1.1  christos 
    367      1.1  christos     for (n = 0; n < GF2_DIM; n++)
    368      1.1  christos         square[n] = gf2_matrix_times(mat, mat[n]);
    369      1.1  christos }
    370      1.1  christos 
    371      1.1  christos /* ========================================================================= */
    372      1.1  christos local uLong crc32_combine_(crc1, crc2, len2)
    373      1.1  christos     uLong crc1;
    374      1.1  christos     uLong crc2;
    375      1.1  christos     z_off64_t len2;
    376      1.1  christos {
    377      1.1  christos     int n;
    378      1.1  christos     unsigned long row;
    379      1.1  christos     unsigned long even[GF2_DIM];    /* even-power-of-two zeros operator */
    380      1.1  christos     unsigned long odd[GF2_DIM];     /* odd-power-of-two zeros operator */
    381      1.1  christos 
    382      1.1  christos     /* degenerate case (also disallow negative lengths) */
    383      1.1  christos     if (len2 <= 0)
    384      1.1  christos         return crc1;
    385      1.1  christos 
    386      1.1  christos     /* put operator for one zero bit in odd */
    387      1.1  christos     odd[0] = 0xedb88320UL;          /* CRC-32 polynomial */
    388      1.1  christos     row = 1;
    389      1.1  christos     for (n = 1; n < GF2_DIM; n++) {
    390      1.1  christos         odd[n] = row;
    391      1.1  christos         row <<= 1;
    392      1.1  christos     }
    393      1.1  christos 
    394      1.1  christos     /* put operator for two zero bits in even */
    395      1.1  christos     gf2_matrix_square(even, odd);
    396      1.1  christos 
    397      1.1  christos     /* put operator for four zero bits in odd */
    398      1.1  christos     gf2_matrix_square(odd, even);
    399      1.1  christos 
    400      1.1  christos     /* apply len2 zeros to crc1 (first square will put the operator for one
    401      1.1  christos        zero byte, eight zero bits, in even) */
    402      1.1  christos     do {
    403      1.1  christos         /* apply zeros operator for this bit of len2 */
    404      1.1  christos         gf2_matrix_square(even, odd);
    405      1.1  christos         if (len2 & 1)
    406      1.1  christos             crc1 = gf2_matrix_times(even, crc1);
    407      1.1  christos         len2 >>= 1;
    408      1.1  christos 
    409      1.1  christos         /* if no more bits set, then done */
    410      1.1  christos         if (len2 == 0)
    411      1.1  christos             break;
    412      1.1  christos 
    413      1.1  christos         /* another iteration of the loop with odd and even swapped */
    414      1.1  christos         gf2_matrix_square(odd, even);
    415      1.1  christos         if (len2 & 1)
    416      1.1  christos             crc1 = gf2_matrix_times(odd, crc1);
    417      1.1  christos         len2 >>= 1;
    418      1.1  christos 
    419      1.1  christos         /* if no more bits set, then done */
    420      1.1  christos     } while (len2 != 0);
    421      1.1  christos 
    422      1.1  christos     /* return combined crc */
    423      1.1  christos     crc1 ^= crc2;
    424      1.1  christos     return crc1;
    425      1.1  christos }
    426      1.1  christos 
    427      1.1  christos /* ========================================================================= */
    428      1.1  christos uLong ZEXPORT crc32_combine(crc1, crc2, len2)
    429      1.1  christos     uLong crc1;
    430      1.1  christos     uLong crc2;
    431      1.1  christos     z_off_t len2;
    432      1.1  christos {
    433      1.1  christos     return crc32_combine_(crc1, crc2, len2);
    434      1.1  christos }
    435      1.1  christos 
    436      1.1  christos uLong ZEXPORT crc32_combine64(crc1, crc2, len2)
    437      1.1  christos     uLong crc1;
    438      1.1  christos     uLong crc2;
    439      1.1  christos     z_off64_t len2;
    440      1.1  christos {
    441      1.1  christos     return crc32_combine_(crc1, crc2, len2);
    442      1.1  christos }
    443